Skip to content

Commit eb11fe4

Browse files
authored
Technical/Increase project code quality (#60)
* Added cspell * Changed mdlrc to markdownlint * Updated lefthook, yamlint configs * Updated rubocop/codeclimate/circleci configs * Fixed linters issues * Updated gemspecs, gem version
1 parent bdf6806 commit eb11fe4

16 files changed

Lines changed: 118 additions & 56 deletions

.circleci/config.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,16 @@ references:
3737
command: |
3838
bundle exec smtp_mock -s -i ~
3939
40-
install_yamllint: &install_yamllint
40+
install_linters: &install_linters
4141
run:
42-
name: Installing Yamllint
43-
command: |
44-
sudo apt-get update -y
45-
sudo apt-get install -y yamllint
46-
47-
install_lefthook: &install_lefthook
48-
run:
49-
name: Installing Lefthook
42+
name: Installing bunch of linters
5043
command: |
5144
curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash
52-
sudo apt-get install -y lefthook
45+
sudo apt-get update -y
46+
sudo apt-get install -y lefthook shellcheck yamllint
47+
npm install --prefix='~/.local' --global --save-dev git+https://github.com/streetsidesoftware/cspell-cli markdownlint-cli
48+
cp .circleci/linter_configs/.fasterer.yml .fasterer.yml
49+
cp .circleci/linter_configs/.lefthook.yml lefthook.yml
5350
5451
install_codeclimate_reporter: &install_codeclimate_reporter
5552
run:
@@ -83,24 +80,24 @@ jobs:
8380
- <<: *restore_bundle_cache
8481
- <<: *bundle_install
8582
- <<: *save_bundle_cache
86-
- <<: *install_yamllint
87-
- <<: *install_lefthook
83+
- <<: *install_linters
8884

8985
- run:
9086
name: Running code style linters
9187
command: lefthook run code-style-linters
9288

9389
- run:
9490
name: Running code performance linters
95-
command: |
96-
cp .circleci/linter_configs/.fasterer.yml .fasterer.yml
97-
lefthook run code-performance-linters
98-
rm .fasterer.yml
91+
command: lefthook run code-performance-linters
9992

10093
- run:
10194
name: Running code vulnerability linters
10295
command: lefthook run code-vulnerability-linters
10396

97+
- run:
98+
name: Running code documentation linters
99+
command: lefthook run code-documentation-linters
100+
104101
tests-ruby:
105102
parameters:
106103
ruby-version:
@@ -186,7 +183,7 @@ workflows:
186183
- linters-ruby:
187184
matrix:
188185
parameters:
189-
ruby-version: ["3.1"]
186+
ruby-version: ["3.1-node"]
190187
- tests-ruby:
191188
matrix:
192189
parameters:

.circleci/gemspecs/compatible

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
88
spec.authors = ['Vladislav Trotsenko']
99
spec.email = %w[admin@bestweb.com.ua]
1010
spec.summary = %(smtp_mock)
11-
spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.)
11+
spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behavior for your test environment.)
1212
spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock'
1313
spec.license = 'MIT'
1414

.circleci/gemspecs/latest

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
88
spec.authors = ['Vladislav Trotsenko']
99
spec.email = %w[admin@bestweb.com.ua]
1010
spec.summary = %(smtp_mock)
11-
spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.)
11+
spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behavior for your test environment.)
1212
spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock'
1313
spec.license = 'MIT'
1414

@@ -22,13 +22,12 @@ Gem::Specification.new do |spec|
2222
spec.add_development_dependency 'bundler-audit', '~> 0.9.1'
2323
spec.add_development_dependency 'fasterer', '~> 0.10.0'
2424
spec.add_development_dependency 'ffaker', '~> 2.21'
25-
spec.add_development_dependency 'mdl', '~> 0.12.0'
2625
spec.add_development_dependency 'net-smtp', '~> 0.3.3'
2726
spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1'
2827
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
2928
spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.1'
3029
spec.add_development_dependency 'rspec', '~> 3.12'
31-
spec.add_development_dependency 'rubocop', '~> 1.39'
30+
spec.add_development_dependency 'rubocop', '~> 1.40'
3231
spec.add_development_dependency 'rubocop-performance', '~> 1.15', '>= 1.15.1'
3332
spec.add_development_dependency 'rubocop-rspec', '~> 2.15'
3433
spec.add_development_dependency 'simplecov', '~> 0.21.2'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
3+
enableGlobDot: true
4+
5+
patterns:
6+
- name: GithubUser
7+
pattern: /\[@.+\]/gmx
8+
- name: MarkdownCode
9+
pattern: /`{1,3}.+`{1,3}/gmx
10+
- name: MarkdownCodeBlock
11+
pattern: /^\s*```[\s\S]*?^\s*```/gmx
12+
13+
languageSettings:
14+
- languageId: markdown
15+
ignoreRegExpList:
16+
- Email
17+
- GithubUser
18+
- MarkdownCode
19+
- MarkdownCodeBlock
20+
21+
words:
22+
- Commiting
23+
- PORO
24+
- Trotsenko
25+
- Vladislav
26+
- bestwebua
27+
- codebases
28+
- gemspecs
29+
- kwarg
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@
22

33
skip_output:
44
- meta
5+
56
code-style-linters:
67
commands:
7-
markdownlint:
8-
run: bundle exec mdl . -s './.circleci/linter_configs/.mdlrc'
98
reek:
109
run: bundle exec reek
1110
rubocop:
1211
run: bundle exec rubocop -c '.circleci/linter_configs/.rubocop.yml'
12+
shellcheck:
13+
glob: '*.{sh}'
14+
run: shellcheck --norc {all_files}
1315
yamllint:
1416
run: yamllint -c '.circleci/linter_configs/.yamllint.yml' .
17+
1518
code-performance-linters:
1619
commands:
1720
fasterer:
1821
run: bundle exec fasterer
22+
1923
code-vulnerability-linters:
2024
commands:
2125
bundle-audit:
22-
run: bundle exec bundle-audit check --update -c '.circleci/linter_configs/.bundler-audit.yml'
26+
run: bundle exec bundle-audit check -c '.circleci/linter_configs/.bundler-audit.yml' --update
27+
28+
code-documentation-linters:
29+
commands:
30+
cspell:
31+
run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}'
32+
markdownlint:
33+
run: markdownlint -c '.circleci/linter_configs/.markdownlint.yml' '**/*.md'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
3+
default: true
4+
5+
MD013:
6+
line_length: 500
7+
8+
MD024:
9+
siblings_only: true

.circleci/linter_configs/.mdlrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.circleci/linter_configs/.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Style/ParallelAssignment:
5656
Style/RescueStandardError:
5757
Enabled: false
5858

59+
Style/RedundantConstantBase:
60+
Enabled: false
61+
5962
# Layout ----------------------------------------------------------------------
6063

6164
Layout/LineLength:

.circleci/scripts/release.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# !/bin/sh
1+
#!/bin/sh
22
set -e
33

44
GH_CLI_RELEASES_URL="https://github.com/cli/cli/releases"
@@ -8,7 +8,7 @@ DELIMETER="_"
88
PACKAGE_FILE="$FILE_NAME$DELIMETER$BUILD_ARCHITECTURE"
99

1010
gh_cli_latest_release() {
11-
curl -sL -o /dev/null -w %{url_effective} "$GH_CLI_RELEASES_URL/latest" | rev | cut -f1 -d'/'| rev
11+
curl -sL -o /dev/null -w '%{url_effective}' "$GH_CLI_RELEASES_URL/latest" | rev | cut -f1 -d'/'| rev
1212
}
1313

1414
download_gh_cli() {
@@ -17,7 +17,7 @@ download_gh_cli() {
1717
echo "Unable to get GitHub CLI release." >&2
1818
exit 1
1919
}
20-
curl -s -L -o "$PACKAGE_FILE" "$GH_CLI_RELEASES_URL/download/$VERSION/$FILE_NAME$DELIMETER${VERSION:1}$DELIMETER$BUILD_ARCHITECTURE"
20+
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"
2121
}
2222

2323
install_gh_cli() {
@@ -26,7 +26,7 @@ install_gh_cli() {
2626
}
2727

2828
get_release_candidate_version() {
29-
echo $(ruby -r rubygems -e "puts Gem::Specification::load('$(ls *.gemspec)').version")
29+
ruby -r rubygems -e "puts Gem::Specification::load('$(ls -- *.gemspec)').version"
3030
}
3131

3232
release_candidate_tag="v$(get_release_candidate_version)"
@@ -39,8 +39,8 @@ release_to_rubygems() {
3939
echo "Setting RubyGems publisher credentials..."
4040
./.circleci/scripts/set_publisher_credentials.sh
4141
echo "Preparation for release..."
42-
git config --global user.email ${PUBLISHER_EMAIL}
43-
git config --global user.name ${PUBLISHER_NAME}
42+
git config --global user.email "${PUBLISHER_EMAIL}"
43+
git config --global user.name "${PUBLISHER_NAME}"
4444
git stash
4545
git checkout develop
4646
gem install yard gem-ctags

.circleci/scripts/set_publisher_credentials.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# !/bin/sh
1+
#!/bin/sh
22
set -e
33
set +x
44
mkdir -p ~/.gem

0 commit comments

Comments
 (0)