Skip to content

Commit

Permalink
Autolint JSON dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysonvirissimo committed Aug 10, 2024
1 parent 26737c4 commit be973c7
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 20 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Tests and Linting

on:
pull_request:
Expand Down Expand Up @@ -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
69 changes: 51 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
15 changes: 15 additions & 0 deletions bin/lint
Original file line number Diff line number Diff line change
Expand Up @@ -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."
3 changes: 2 additions & 1 deletion medieval_latina.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit be973c7

Please sign in to comment.