From 66792e19cbec044b1fa45ad56d6826a39c6cd490 Mon Sep 17 00:00:00 2001 From: Matt Petro Date: Tue, 28 Feb 2023 10:25:51 -0500 Subject: [PATCH] Fix github CI linter --- .github/workflows/github-actions-ci-lint.yml | 68 +++++++++++---- .rubocop.yml | 21 ++++- Gemfile | 2 +- Gemfile.lock | 89 ++++++++++++-------- 4 files changed, 127 insertions(+), 53 deletions(-) diff --git a/.github/workflows/github-actions-ci-lint.yml b/.github/workflows/github-actions-ci-lint.yml index ffe4915f..f5629c02 100644 --- a/.github/workflows/github-actions-ci-lint.yml +++ b/.github/workflows/github-actions-ci-lint.yml @@ -1,29 +1,63 @@ -name: linter +on: [pull_request] -on: - push: - branches: [ i_amDisabl_ed] +name: Pronto -jobs: - test: +permissions: + contents: read + pull-requests: write + statuses: write +jobs: + linters: + name: Linters runs-on: ubuntu-latest - + strategy: + matrix: + ruby-version: [2.7] steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Ruby + - run: | + git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/* + + - name: Setup Ruby uses: ruby/setup-ruby@v1 + + - name: Ruby gem cache + uses: actions/cache@v1 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + + - name: Install gems + run: | + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - name: Find yarn cache location + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: JS package cache + uses: actions/cache@v1 with: - ruby-version: 2.7 - bundler-cache: true + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - - name: Install dependencies - env: - RAILS_ENV: test - RAILS_GROUPS: build - run: bundle install + - name: Install packages + run: | + yarn install --pure-lockfile - - name: Run linter - run: git diff --name-only origin/master | bundle exec xargs rubocop --force-exclusion --parallel + - name: Run Pronto + run: | + PRONTO_PULL_REQUEST_ID="${{ github.event.pull_request.number }}" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }} diff --git a/.rubocop.yml b/.rubocop.yml index d6b7a22a..a8efc12e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,9 +1,11 @@ -require: +require: + - rubocop-rspec - rubocop-rails - rubocop-performance AllCops: TargetRubyVersion: 2.7 + NewCops: enable Exclude: - db/schema.rb - config/initializers/devise.rb @@ -94,7 +96,6 @@ Style/ClassVars: Style/CollectionMethods: Enabled: true PreferredMethods: - find: detect inject: reduce collect: map find_all: select @@ -178,6 +179,11 @@ Layout/EmptyLinesAroundModuleBody: Description: 'Do not allow extra lines around module body.' Enabled: false +Layout/FirstHashElementIndentation: + Description: >- + Checks the indentation of the first Hash element + EnforcedStyle: consistent + Naming/FileName: Description: 'Use snake_case for source file names.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files' @@ -242,6 +248,9 @@ Metrics/MethodLength: StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods' Enabled: false +Metrics/PerceivedComplexity: + Enabled: false + Style/ModuleFunction: Description: 'Checks for usage of `extend self` in modules.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function' @@ -636,6 +645,10 @@ Rails/HasAndBelongsToMany: Description: 'Prefer has_many :through to has_and_belongs_to_many.' Enabled: false +Rails/HelperInstanceVariable: + Description: 'Checks for use of the helper methods which reference instance variables.' + Enabled: false + Rails/Output: Description: 'Checks for calls to puts, print, etc.' Enabled: false @@ -788,3 +801,7 @@ Performance/Squeeze: Performance/StringInclude: Enabled: true + +Style/RedundantInterpolation: + Enabled: false + diff --git a/Gemfile b/Gemfile index d37fc1dc..0bb39bed 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem "devise_invitable" gem "devise-two-factor" # TOTP for devise gem "rqrcode", "~> 2.1" # Generate QR codes for TOTP gem "strong_password" -gem "ims-lti", "~> 2.1.5" # IMS LTI tool consumers and providers +gem "ims-lti", "~> 2.3.3" # IMS LTI tool consumers and providers gem "json-jwt" gem "jwt" gem "lms-api", "~>1.23.0" diff --git a/Gemfile.lock b/Gemfile.lock index 586ec923..107a7bf7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,8 +74,8 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) apartment-activejob-que (1.0.0) activesupport @@ -90,6 +90,8 @@ GEM rack (>= 0.9.0) bindata (2.4.10) bindex (0.8.1) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) bootsnap (1.11.1) msgpack (~> 1.2) brakeman (5.2.3) @@ -123,6 +125,7 @@ GEM debase (0.2.4.1) debase-ruby_core_source (>= 0.10.2) debase-ruby_core_source (0.10.15) + debug_inspector (1.1.0) devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -158,14 +161,35 @@ GEM railties (>= 5.0.0) faker (2.21.0) i18n (>= 1.8.11, < 2) - faraday (0.17.5) - multipart-post (>= 1.2, < 3) - faraday_middleware (0.14.0) - faraday (>= 0.7.4, < 1.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) ffi (1.15.5) formatador (1.1.0) - gitlab (4.18.0) - httparty (~> 0.18) + gitlab (4.19.0) + httparty (~> 0.20) terminal-table (>= 1.5.1) globalid (1.0.0) activesupport (>= 5.0) @@ -191,19 +215,20 @@ GEM rspec (>= 2.99.0, < 4.0) hashdiff (1.0.1) hashie (5.0.0) - httparty (0.20.0) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) hub (1.12.4) i18n (1.10.0) concurrent-ruby (~> 1.0) - ims-lti (2.1.6) + ims-lti (2.3.3) addressable (~> 2.5, >= 2.5.1) builder (~> 3.2) - faraday (~> 0.8) - faraday_middleware (~> 0.8) + faraday (< 2.0) + faraday_middleware (< 2.0) json-jwt (~> 1.7) - simple_oauth (= 0.2) + rexml + simple_oauth (~> 0.3.1) jsbundling-rails (1.0.3) railties (>= 6.0.0) json (2.6.2) @@ -235,15 +260,12 @@ GEM marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) mini_mime (1.1.2) minitest (5.15.0) msgpack (1.5.1) multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.1.1) + multipart-post (2.3.0) nenv (0.3.0) net-imap (0.2.3) digest @@ -273,9 +295,9 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - octokit (4.22.0) - faraday (>= 0.9) - sawyer (~> 0.8.0, >= 0.5.3) + octokit (6.0.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) @@ -291,13 +313,13 @@ GEM ast (~> 2.4.1) pg (1.3.5) promise.rb (0.7.4) - pronto (0.11.0) - gitlab (~> 4.4, >= 4.4.0) - httparty (>= 0.13.7) - octokit (~> 4.7, >= 4.7.0) + pronto (0.11.1) + gitlab (>= 4.4.0, < 5.0) + httparty (>= 0.13.7, < 1.0) + octokit (>= 4.7.0, < 7.0) rainbow (>= 2.2, < 4.0) - rexml (~> 3.2) - rugged (>= 0.23.0, < 1.1.0) + rexml (>= 3.2.5, < 4.0) + rugged (>= 0.23.0, < 2.0) thor (>= 0.20.3, < 2.0) pronto-eslint (0.11.0) eslintrb (~> 2.0, >= 2.0.0) @@ -426,11 +448,12 @@ GEM ruby-debug-ide (0.7.3) rake (>= 0.8.1) ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) rubyzip (2.3.2) - rugged (1.0.1) - sawyer (0.8.2) + rugged (1.5.1) + sawyer (0.9.2) addressable (>= 2.3.5) - faraday (> 0.8, < 2.0) + faraday (>= 0.17.3, < 3) selenium-webdriver (4.1.0) childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) @@ -440,7 +463,7 @@ GEM shellany (0.0.1) shoulda-matchers (5.1.0) activesupport (>= 5.2.0) - simple_oauth (0.2.0) + simple_oauth (0.3.1) strong_password (0.0.10) strscan (3.0.3) terminal-table (3.0.2) @@ -452,7 +475,7 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (2.1.0) + unicode-display_width (2.4.2) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.0) @@ -503,7 +526,7 @@ DEPENDENCIES guard-rspec httparty hub - ims-lti (~> 2.1.5) + ims-lti (~> 2.3.3) jsbundling-rails json-jwt jwt