Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
armandfardeau committed May 18, 2022
2 parents daa4e80 + ba93cd9 commit 0bbd9de
Show file tree
Hide file tree
Showing 21 changed files with 738 additions and 384 deletions.
12 changes: 12 additions & 0 deletions .github/run_erblint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

shopt -s globstar

bundle exec erblint app/{cells,views}/**/*.erb

# Store the return code of the erblint execution
EXIT_CODE=$?

shopt -u globstar

exit $EXIT_CODE
14 changes: 14 additions & 0 deletions .github/upload_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

REPORT_NAME=$1
EVENT_PAYLOAD_FILE=$2

PRID=`jq ".number // .check_run.pull_requests[0].number" $EVENT_PAYLOAD_FILE`
SHA=`jq -r ".pull_request.head.sha // .check_run.head_sha // .after" $EVENT_PAYLOAD_FILE`

if [ $PRID = "null" ]
then
bash <(curl -s https://codecov.io/bash) -n $REPORT_NAME -C $SHA
else
bash <(curl -s https://codecov.io/bash) -n $REPORT_NAME -C $SHA -P $PRID
fi
51 changes: 51 additions & 0 deletions .github/workflows/lint_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "[CI] Lint"
on:
push:
branches:
- develop
- release/*
- "*-stable"
pull_request:
branches-ignore:
- "chore/l10n*"

env:
CI: "true"
SIMPLECOV: "true"
RUBY_VERSION: 2.6.6

jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm get cache)-lint"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-
- name: Install JS dependencies
run: npm ci
- run: bundle exec rubocop -P
name: Lint Ruby files
37 changes: 19 additions & 18 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AllCops:
- "development_app/**/*"
- "spec/decidim_dummy_app/**/*"
- "node_modules/**/*"
- "decidim-generators/pkg/gems/**/*"
- "pkg/gems/**/*"
# Default formatter will be used if no -f/--format option is given.
DefaultFormatter: progress
# Cop names are not displayed in offense messages by default. Change behavior
Expand Down Expand Up @@ -66,7 +64,7 @@ AllCops:
# If a value is specified for TargetRubyVersion then it is used.
# Else if .ruby-version exists and it contains an MRI version it is used.
# Otherwise we fallback to the oldest officially supported Ruby version (2.0).
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6

RSpec:
Patterns:
Expand Down Expand Up @@ -470,7 +468,7 @@ Naming/FileName:
# files with a shebang in the first line).
IgnoreExecutableScripts: true

Layout/FirstParameterIndentation:
Layout/IndentFirstArgument:
EnforcedStyle: special_for_inner_method_call_in_parentheses
SupportedStyles:
# The first parameter should always be indented one step more than the
Expand Down Expand Up @@ -507,15 +505,13 @@ Style/FormatStringToken:
EnforcedStyle: template

Style/FrozenStringLiteralComment:
EnforcedStyle: when_needed
EnforcedStyle: always
SupportedStyles:
# `when_needed` will add the frozen string literal comment to files
# only when the `TargetRubyVersion` is set to 2.5+.
- when_needed
- never
# `always` will always add the frozen string literal comment to a file
# regardless of the Ruby version or if `freeze` or `<<` are called on a
# string literal. If you run code against multiple versions of Ruby, it is
# possible that this will create errors in Ruby 2.5.0+.
# possible that this will create errors in Ruby 2.3.0+.
- always

# Built-in global variables are allowed by default.
Expand Down Expand Up @@ -560,7 +556,7 @@ Layout/IndentationWidth:
Width: 2

# Checks the indentation of the first element in an array literal.
Layout/IndentArray:
Layout/IndentFirstArrayElement:
# The value `special_inside_parentheses` means that array literals with
# brackets that have their opening bracket on the same line as a surrounding
# opening round parenthesis, shall have their first element indented relative
Expand Down Expand Up @@ -588,7 +584,7 @@ Layout/IndentAssignment:
IndentationWidth: ~

# Checks the indentation of the first key in a hash literal.
Layout/IndentHash:
Layout/IndentFirstHashElement:
# The value `special_inside_parentheses` means that hash literals with braces
# that have their opening brace on the same line as a surrounding opening
# round parenthesis, shall have their first key indented relative to the
Expand Down Expand Up @@ -1116,8 +1112,6 @@ Metrics/LineLength:
- https
Exclude:
- "**/spec/**/*"
- "decidim-generators/pkg/**/*"
- "pkg/**/*"

Metrics/MethodLength:
CountComments: false # count full line comments?
Expand Down Expand Up @@ -1194,10 +1188,6 @@ Lint/UnusedMethodArgument:

##################### Performance ############################

Performance/RedundantMerge:
# Max number of key-value pairs to consider an offense
MaxKeyValuePairs: 2

Metrics/BlockLength:
Enabled: false

Expand Down Expand Up @@ -1241,15 +1231,26 @@ RSpec/MessageSpies:
Enabled: false

RSpec/MultipleExpectations:
Max: 20
Enabled: false

RSpec/NestedGroups:
Max: 7

RSpec/NamedSubject:
Enabled: false

RSpec/RepeatedExampleGroupDescription:
Enabled: false

RSpec/RepeatedExampleGroupBody:
Enabled: false
RSpec/VerifiedDoubles:
Enabled: false

RSpec/LeakyConstantDeclaration:
Enabled: false

RSpec/DescribedClass:
Enabled: false

inherit_from: .rubocop_rails.yml
3 changes: 3 additions & 0 deletions .rubocop_rails.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require: rubocop-rails

Rails:
Enabled: true

Expand Down Expand Up @@ -58,6 +60,7 @@ Rails/Output:
- decidim-core/lib/decidim/component_manifest.rb
- decidim-core/lib/decidim/participatory_space_manifest.rb
- decidim-system/db/seeds.rb
- decidim-templates/db/seeds.rb

Rails/OutputSafety:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.3
2.6.6
19 changes: 14 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ source "https://rubygems.org"

ruby RUBY_VERSION

gem "decidim", git: "https://github.com/OpenSourcePolitics/decidim", branch: "0.18-merge"
# Inside the development app, the relative require has to be one level up, as
# the Gemfile is copied to the development_app folder (almost) as is.
# Source: https://github.com/mainio/decidim-module-antivirus/blob/master/Gemfile
base_path = ""
base_path = "../" if File.basename(__dir__) == "development_app"
require_relative "#{base_path}lib/decidim/socio_demographic_authorization_handler/version"

gem "decidim", git: "https://github.com/decidim/decidim", branch: Decidim::SocioDemographicAuthorizationHandler.decidim_version
gem "decidim-socio_demographic_authorization_handler", path: "."

gem "bootsnap"
gem "puma", "~> 3.0"
gem "bootsnap", "~> 1.4"

gem "puma", "~> 4.3.7"
gem "uglifier", "~> 4.1"

group :development, :test do
gem "byebug", "~> 10.0", platform: :mri
gem "byebug", "~> 11.0", platform: :mri
gem "simplecov", "~> 0.19.0"

gem "decidim-dev", git: "https://github.com/OpenSourcePolitics/decidim", branch: "0.18-merge"
gem "decidim-dev", git: "https://github.com/decidim/decidim", branch: Decidim::SocioDemographicAuthorizationHandler.decidim_version
end

group :development do
Expand Down
Loading

0 comments on commit 0bbd9de

Please sign in to comment.