diff --git a/.circleci/config.yml b/.circleci/config.yml index f688f38..4553596 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,19 +37,16 @@ references: command: | bundle exec smtp_mock -s -i ~ - install_yamllint: &install_yamllint + install_linters: &install_linters run: - name: Installing Yamllint - command: | - sudo apt-get update -y - sudo apt-get install -y yamllint - - install_lefthook: &install_lefthook - run: - name: Installing Lefthook + name: Installing bunch of linters command: | curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash - sudo apt-get install -y lefthook + sudo apt-get update -y + sudo apt-get install -y lefthook shellcheck yamllint + npm install --prefix='~/.local' --global --save-dev git+https://github.com/streetsidesoftware/cspell-cli markdownlint-cli + cp .circleci/linter_configs/.fasterer.yml .fasterer.yml + cp .circleci/linter_configs/.lefthook.yml lefthook.yml install_codeclimate_reporter: &install_codeclimate_reporter run: @@ -83,8 +80,7 @@ jobs: - <<: *restore_bundle_cache - <<: *bundle_install - <<: *save_bundle_cache - - <<: *install_yamllint - - <<: *install_lefthook + - <<: *install_linters - run: name: Running code style linters @@ -92,15 +88,16 @@ jobs: - run: name: Running code performance linters - command: | - cp .circleci/linter_configs/.fasterer.yml .fasterer.yml - lefthook run code-performance-linters - rm .fasterer.yml + command: lefthook run code-performance-linters - run: name: Running code vulnerability linters command: lefthook run code-vulnerability-linters + - run: + name: Running code documentation linters + command: lefthook run code-documentation-linters + tests-ruby: parameters: ruby-version: @@ -186,7 +183,7 @@ workflows: - linters-ruby: matrix: parameters: - ruby-version: ["3.1"] + ruby-version: ["3.1-node"] - tests-ruby: matrix: parameters: diff --git a/.circleci/gemspecs/compatible b/.circleci/gemspecs/compatible index 89b410d..9ed6c8d 100644 --- a/.circleci/gemspecs/compatible +++ b/.circleci/gemspecs/compatible @@ -8,7 +8,7 @@ Gem::Specification.new do |spec| spec.authors = ['Vladislav Trotsenko'] spec.email = %w[admin@bestweb.com.ua] spec.summary = %(smtp_mock) - spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.) + spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behavior for your test environment.) spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock' spec.license = 'MIT' diff --git a/.circleci/gemspecs/latest b/.circleci/gemspecs/latest index e385352..3e6e889 100644 --- a/.circleci/gemspecs/latest +++ b/.circleci/gemspecs/latest @@ -8,7 +8,7 @@ Gem::Specification.new do |spec| spec.authors = ['Vladislav Trotsenko'] spec.email = %w[admin@bestweb.com.ua] spec.summary = %(smtp_mock) - spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.) + spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behavior for your test environment.) spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock' spec.license = 'MIT' @@ -22,13 +22,12 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler-audit', '~> 0.9.1' spec.add_development_dependency 'fasterer', '~> 0.10.0' spec.add_development_dependency 'ffaker', '~> 2.21' - spec.add_development_dependency 'mdl', '~> 0.12.0' spec.add_development_dependency 'net-smtp', '~> 0.3.3' spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1' spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6' spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.1' spec.add_development_dependency 'rspec', '~> 3.12' - spec.add_development_dependency 'rubocop', '~> 1.39' + spec.add_development_dependency 'rubocop', '~> 1.40' spec.add_development_dependency 'rubocop-performance', '~> 1.15', '>= 1.15.1' spec.add_development_dependency 'rubocop-rspec', '~> 2.15' spec.add_development_dependency 'simplecov', '~> 0.21.2' diff --git a/.circleci/linter_configs/.cspell.yml b/.circleci/linter_configs/.cspell.yml new file mode 100644 index 0000000..844afd4 --- /dev/null +++ b/.circleci/linter_configs/.cspell.yml @@ -0,0 +1,29 @@ +--- + +enableGlobDot: true + +patterns: + - name: GithubUser + pattern: /\[@.+\]/gmx + - name: MarkdownCode + pattern: /`{1,3}.+`{1,3}/gmx + - name: MarkdownCodeBlock + pattern: /^\s*```[\s\S]*?^\s*```/gmx + +languageSettings: + - languageId: markdown + ignoreRegExpList: + - Email + - GithubUser + - MarkdownCode + - MarkdownCodeBlock + +words: + - Commiting + - PORO + - Trotsenko + - Vladislav + - bestwebua + - codebases + - gemspecs + - kwarg diff --git a/lefthook.yml b/.circleci/linter_configs/.lefthook.yml similarity index 51% rename from lefthook.yml rename to .circleci/linter_configs/.lefthook.yml index f43fb86..8eb1581 100644 --- a/lefthook.yml +++ b/.circleci/linter_configs/.lefthook.yml @@ -2,21 +2,32 @@ skip_output: - meta + code-style-linters: commands: - markdownlint: - run: bundle exec mdl . -s './.circleci/linter_configs/.mdlrc' reek: run: bundle exec reek rubocop: run: bundle exec rubocop -c '.circleci/linter_configs/.rubocop.yml' + shellcheck: + glob: '*.{sh}' + run: shellcheck --norc {all_files} yamllint: run: yamllint -c '.circleci/linter_configs/.yamllint.yml' . + code-performance-linters: commands: fasterer: run: bundle exec fasterer + code-vulnerability-linters: commands: bundle-audit: - run: bundle exec bundle-audit check --update -c '.circleci/linter_configs/.bundler-audit.yml' + run: bundle exec bundle-audit check -c '.circleci/linter_configs/.bundler-audit.yml' --update + +code-documentation-linters: + commands: + cspell: + run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}' + markdownlint: + run: markdownlint -c '.circleci/linter_configs/.markdownlint.yml' '**/*.md' diff --git a/.circleci/linter_configs/.markdownlint.yml b/.circleci/linter_configs/.markdownlint.yml new file mode 100644 index 0000000..065b285 --- /dev/null +++ b/.circleci/linter_configs/.markdownlint.yml @@ -0,0 +1,9 @@ +--- + +default: true + +MD013: + line_length: 500 + +MD024: + siblings_only: true diff --git a/.circleci/linter_configs/.mdlrc b/.circleci/linter_configs/.mdlrc deleted file mode 100644 index aa2313b..0000000 --- a/.circleci/linter_configs/.mdlrc +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -all -rule 'MD013', line_length: 500 -rule 'MD029', style: :ordered -exclude_rule 'MD007' -exclude_rule 'MD024' diff --git a/.circleci/linter_configs/.rubocop.yml b/.circleci/linter_configs/.rubocop.yml index 8645cc6..26ed510 100644 --- a/.circleci/linter_configs/.rubocop.yml +++ b/.circleci/linter_configs/.rubocop.yml @@ -56,6 +56,9 @@ Style/ParallelAssignment: Style/RescueStandardError: Enabled: false +Style/RedundantConstantBase: + Enabled: false + # Layout ---------------------------------------------------------------------- Layout/LineLength: diff --git a/.circleci/scripts/release.sh b/.circleci/scripts/release.sh index 41d641f..13c0de3 100755 --- a/.circleci/scripts/release.sh +++ b/.circleci/scripts/release.sh @@ -1,4 +1,4 @@ -# !/bin/sh +#!/bin/sh set -e GH_CLI_RELEASES_URL="https://github.com/cli/cli/releases" @@ -8,7 +8,7 @@ DELIMETER="_" PACKAGE_FILE="$FILE_NAME$DELIMETER$BUILD_ARCHITECTURE" gh_cli_latest_release() { - curl -sL -o /dev/null -w %{url_effective} "$GH_CLI_RELEASES_URL/latest" | rev | cut -f1 -d'/'| rev + curl -sL -o /dev/null -w '%{url_effective}' "$GH_CLI_RELEASES_URL/latest" | rev | cut -f1 -d'/'| rev } download_gh_cli() { @@ -17,7 +17,7 @@ download_gh_cli() { echo "Unable to get GitHub CLI release." >&2 exit 1 } - curl -s -L -o "$PACKAGE_FILE" "$GH_CLI_RELEASES_URL/download/$VERSION/$FILE_NAME$DELIMETER${VERSION:1}$DELIMETER$BUILD_ARCHITECTURE" + curl -s -L -o "$PACKAGE_FILE" "$GH_CLI_RELEASES_URL/download/$VERSION/$FILE_NAME$DELIMETER$(printf '%s' "$VERSION" | cut -c 2-100)$DELIMETER$BUILD_ARCHITECTURE" } install_gh_cli() { @@ -26,7 +26,7 @@ install_gh_cli() { } get_release_candidate_version() { - echo $(ruby -r rubygems -e "puts Gem::Specification::load('$(ls *.gemspec)').version") + ruby -r rubygems -e "puts Gem::Specification::load('$(ls -- *.gemspec)').version" } release_candidate_tag="v$(get_release_candidate_version)" @@ -39,8 +39,8 @@ release_to_rubygems() { echo "Setting RubyGems publisher credentials..." ./.circleci/scripts/set_publisher_credentials.sh echo "Preparation for release..." - git config --global user.email ${PUBLISHER_EMAIL} - git config --global user.name ${PUBLISHER_NAME} + git config --global user.email "${PUBLISHER_EMAIL}" + git config --global user.name "${PUBLISHER_NAME}" git stash git checkout develop gem install yard gem-ctags diff --git a/.circleci/scripts/set_publisher_credentials.sh b/.circleci/scripts/set_publisher_credentials.sh index f3d725b..36abc15 100755 --- a/.circleci/scripts/set_publisher_credentials.sh +++ b/.circleci/scripts/set_publisher_credentials.sh @@ -1,4 +1,4 @@ -# !/bin/sh +#!/bin/sh set -e set +x mkdir -p ~/.gem diff --git a/.github/BRANCH_NAMING_CONVENTION.md b/.github/BRANCH_NAMING_CONVENTION.md index 1eacce6..f16f264 100644 --- a/.github/BRANCH_NAMING_CONVENTION.md +++ b/.github/BRANCH_NAMING_CONVENTION.md @@ -16,7 +16,7 @@ bugfix/fix-some-bug-name ### Squash commits -Please squash all branch commits into the one before openning your PR from your fork. It's simple to do with the git: +Please squash all branch commits into the one before opening your PR from your fork. It's simple to do with the git: ```bash git rebase -i [hash your first commit of your branch]~1 @@ -25,9 +25,9 @@ git rebase -i 6467fe36232401fa740af067cfd8ac9ec932fed2~1 # example ### Add commit description -Please complete your commit description folowing next pattern: +Please complete your commit description following next pattern: -``` +```code Technical/Add info files # should be the same name as your branch name * Added license, changelog, contributing, code of conduct docs diff --git a/CHANGELOG.md b/CHANGELOG.md index 602fedd..7543ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.2] - 2022-12-12 + +### Added + +- Added [`cspell`](https://cspell.org) linter +- Added [`markdownlint`](https://github.com/DavidAnson/markdownlint) linter +- Added [`shellcheck`](https://www.shellcheck.net) linter +- Added [`yamllint`](https://yamllint.readthedocs.io) linter + +### Fixed + +- Fixed typos in project's codebase +- Fixed new project's linter issues + +### Updated + +- Updated `CircleCI` config +- Updated [`lefthook`](https://github.com/evilmartians/lefthook) linters aggregator config +- Updated releasing script, gemspecs +- Updated gem version + ## [1.3.1] - 2022-12-01 ### Added @@ -13,7 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Updated - Updated gemspecs -- Updated codeclimate/circleci configs +- Updated `codeclimate`/`circleci` configs - Updated gem development dependencies - Updated gem version @@ -30,7 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Updated - Updated `SmtpMock::Types::Bool`, tests -- Updated codeclimate/circleci configs +- Updated `codeclimate`/`circleci` configs - Updated gemspecs - Updated gem runtime/development dependencies - Updated gem documentation, version @@ -45,7 +66,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Updated gemspecs - Updated tests -- Updated codeclimate/circleci configs +- Updated `codeclimate`/`circleci` configs - Updated gem development dependencies - Updated gem version @@ -71,7 +92,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Updated gemspecs - Updated tests -- Updated rubocop/codeclimate/circleci configs +- Updated `rubocop`/`codeclimate`/`circleci` configs - Updated gem development dependencies - Updated gem documentation, version @@ -84,7 +105,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Updated - Updated gemspecs -- Updated codeclimate/circleci configs +- Updated `codeclimate`/`circleci` configs - Updated gem development dependencies - Updated gem version @@ -97,7 +118,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Updated - Updated gemspecs -- Updated codeclimate/circleci configs +- Updated `codeclimate`/`circleci` configs - Updated gem development dependencies - Updated gem version @@ -128,7 +149,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Updated - Updated gem documentation -- Updated codeclimate config +- Updated `codeclimate` config ## [0.1.0] - 2022-01-18 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d52fed1..c255cc8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform ## Feature requests -Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. +Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to _you_ to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. ## Questions diff --git a/README.md b/README.md index 98ce5e5..ac77106 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ![Ruby SmtpMock - mimic any 📤 SMTP server behaviour for your test environment with fake SMTP server](https://repository-images.githubusercontent.com/443795043/81ce5b00-0915-4dd0-93ad-88e6699e18cd) +# ![Ruby SmtpMock - mimic any 📤 SMTP server behavior for your test environment with fake SMTP server](https://repository-images.githubusercontent.com/443795043/81ce5b00-0915-4dd0-93ad-88e6699e18cd) [![Maintainability](https://api.codeclimate.com/v1/badges/315c5fff7449a11868dd/maintainability)](https://codeclimate.com/github/mocktools/ruby-smtp-mock/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/315c5fff7449a11868dd/test_coverage)](https://codeclimate.com/github/mocktools/ruby-smtp-mock/test_coverage) @@ -9,7 +9,7 @@ [![GitHub](https://img.shields.io/github/license/mocktools/ruby-smtp-mock)](LICENSE.txt) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) -💎 Ruby SMTP mock - flexible Ruby wrapper over [`smtpmock`](https://github.com/mocktools/go-smtp-mock). Mimic any 📤 SMTP server behaviour for your test environment and even more. +💎 Ruby SMTP mock - flexible Ruby wrapper over [`smtpmock`](https://github.com/mocktools/go-smtp-mock). Mimic any 📤 SMTP server behavior for your test environment and even more. ## Table of Contents @@ -34,7 +34,7 @@ ## Features -- Ability to handle configurable behaviour and life cycles of SMTP mock server(s) +- Ability to handle configurable behavior and life cycles of SMTP mock server(s) - Dynamic/manual port assignment - Test framework agnostic (it's PORO, so you can use it outside of `RSpec`, `Test::Unit` or `MiniTest`) - Simple and intuitive DSL @@ -96,7 +96,7 @@ This gem includes easy system dependency manager. Run `bundle exec smtp_mock` wi | Example of usage kwarg | Description | | --- | --- | -| `host: '0.0.0.0'` | Host address where smtpmock will run. It's equal to 127.0.0.1 by default | +| `host: '0.0.0.0'` | Host address where `smtpmock` will run. It's equal to 127.0.0.1 by default | | `port: 2525` | Server port number. If not specified it will be assigned dynamically | | `log: true` | Enables log server activity. Disabled by default | | `session_timeout: 60` | Session timeout in seconds. It's equal to 30 seconds by default | @@ -143,7 +143,7 @@ This gem includes easy system dependency manager. Run `bundle exec smtp_mock` wi ```ruby # Public SmtpMock interface -# Without kwargs creates SMTP mock server with default behaviour. +# Without kwargs creates SMTP mock server with default behavior. # A free port for server will be randomly assigned in the range # from 49152 to 65535. Returns current smtp mock server instance smtp_mock_server = SmtpMock.start_server(not_registered_emails: %w[user@example.com]) # => SmtpMock::Server instance diff --git a/lib/smtp_mock/version.rb b/lib/smtp_mock/version.rb index 3b716df..197f726 100644 --- a/lib/smtp_mock/version.rb +++ b/lib/smtp_mock/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SmtpMock - VERSION = '1.3.1' + VERSION = '1.3.2' end diff --git a/smtp_mock.gemspec b/smtp_mock.gemspec index 8022445..523d388 100644 --- a/smtp_mock.gemspec +++ b/smtp_mock.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| spec.email = %w[admin@bestweb.com.ua] spec.summary = %(smtp_mock) - spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.) + spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behavior for your test environment.) spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock' spec.license = 'MIT'