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 abfe9b0e..472c5b5e 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,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 c453a7fb..1ab56c9e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,10 +188,31 @@ GEM railties (>= 5.0.0) faker (3.1.1) i18n (>= 1.8.11, < 2) - faraday (0.17.6) - 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.19.0) @@ -228,13 +249,14 @@ GEM hub (1.12.4) i18n (1.12.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.1.1) railties (>= 6.0.0) json (2.6.3) @@ -299,11 +321,11 @@ GEM jwt (>= 1.0, < 3.0) multi_xml (~> 0.5) rack (>= 1.2, < 4) + octokit (6.0.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) snaky_hash (~> 2.0) version_gem (~> 1.1) - octokit (4.22.0) - faraday (>= 0.9) - sawyer (~> 0.8.0, >= 0.5.3) omniauth (2.1.1) hashie (>= 3.4.6) rack (>= 2.2.3) @@ -461,12 +483,14 @@ GEM ruby-debug-ide (0.7.3) rake (>= 0.8.1) ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) rubyzip (2.3.2) rugged (1.5.1) - sawyer (0.8.2) + sawyer (0.9.2) addressable (>= 2.3.5) - faraday (> 0.8, < 2.0) - selenium-webdriver (4.8.1) + faraday (>= 0.17.3, < 3) + selenium-webdriver (4.1.0) + childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -475,7 +499,7 @@ GEM shellany (0.0.1) shoulda-matchers (5.3.0) activesupport (>= 5.2.0) - simple_oauth (0.2.0) + simple_oauth (0.3.1) snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) @@ -546,7 +570,7 @@ DEPENDENCIES guard-rspec httparty hub - ims-lti (~> 2.1.5) + ims-lti (~> 2.3.3) jsbundling-rails json-jwt jwt