diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9c5f781..034f6d1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: Tests and Linting on: pull_request: @@ -40,3 +40,23 @@ jobs: bundler-cache: true - name: Test run: bundle exec rake spec || $ALLOW_FAILURES + + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + - name: Install dependencies + run: | + gem install rubocop + gem install jsonlint + - name: Lint Ruby + run: rubocop + - name: Lint JSON + run: jsonlint data/dictionary.json diff --git a/Gemfile.lock b/Gemfile.lock index 8f0ec59..3c573a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,22 +7,36 @@ PATH GEM remote: https://rubygems.org/ specs: - ast (2.4.0) + ast (2.4.2) + bigdecimal (3.1.8) concurrent-ruby (1.2.2) diff-lcs (1.3) i18n (1.13.0) concurrent-ruby (~> 1.0) + json (2.7.2) + jsonlint (0.4.0) + oj (~> 3) + optimist (~> 3) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) mini_portile2 (2.8.6) nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - parallel (1.19.1) - parser (2.7.1.2) - ast (~> 2.4.0) + oj (3.16.5) + bigdecimal (>= 3.0) + ostruct (>= 0.2) + optimist (3.1.0) + ostruct (0.6.0) + parallel (1.26.1) + parser (3.3.4.2) + ast (~> 2.4.1) + racc racc (1.7.3) - rainbow (3.0.0) + rainbow (3.1.1) rake (12.3.3) - rexml (3.3.3) + regexp_parser (2.9.2) + rexml (3.3.4) strscan rspec (3.9.0) rspec-core (~> 3.9.0) @@ -37,31 +51,50 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.3) - rubocop (0.83.0) + rubocop (1.64.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - rexml + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-performance (1.5.2) - rubocop (>= 0.71.0) - ruby-progressbar (1.10.1) - standard (0.4.2) - rubocop (~> 0.83.0) - rubocop-performance (~> 1.5.2) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.0) + parser (>= 3.3.1.0) + rubocop-performance (1.21.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (1.13.0) + standard (1.39.2) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.64.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.4) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.4.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.21.0) + standardrb (1.0.1) + standard strscan (3.1.0) - unicode-display_width (1.7.0) + unicode-display_width (2.5.0) PLATFORMS ruby DEPENDENCIES + jsonlint medieval_latina! nokogiri rake (~> 12.0) rspec (~> 3.0) - standard + standardrb BUNDLED WITH 2.4.1 diff --git a/bin/lint b/bin/lint index 81a8e46..c7c9d36 100755 --- a/bin/lint +++ b/bin/lint @@ -3,4 +3,19 @@ set -euo pipefail IFS=$'\n\t' set -vx +# Run StandardRB to lint and auto-fix Ruby files +echo "Linting Ruby files with StandardRB..." standardrb --fix + +# Check if jsonlint is installed +if ! command -v jsonlint &> /dev/null +then + echo "jsonlint could not be found. Installing..." + gem install jsonlint +fi + +# Run jsonlint to check the dictionary.json file +echo "Linting dictionary.json with jsonlint..." +jsonlint data/dictionary.json + +echo "Linting completed." diff --git a/medieval_latina.gemspec b/medieval_latina.gemspec index a29de37..a6c6bdc 100644 --- a/medieval_latina.gemspec +++ b/medieval_latina.gemspec @@ -32,5 +32,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "nokogiri" - spec.add_development_dependency "standard" + spec.add_development_dependency "standardrb" + spec.add_development_dependency "jsonlint" end