Merge pull request #4382 from consul/pronto

Use Pronto to check code conventions
This commit is contained in:
Javi Martín
2021-03-04 16:05:41 +01:00
committed by GitHub
13 changed files with 199 additions and 107 deletions

1
.eslintrc Symbolic link
View File

@@ -0,0 +1 @@
.eslintrc.json

115
.eslintrc.json Normal file
View File

@@ -0,0 +1,115 @@
{
"env": {
"browser": true,
"es6": false
},
"extends": "eslint:recommended",
"globals": {
"$": "readonly",
"App": "readonly",
"AmsifySuggestags": "readonly",
"annotator": "readonly",
"c3": "readonly",
"CKEDITOR": "readonly",
"L": "readonly",
"Turbolinks": "readonly"
},
"parserOptions": {
"ecmaVersion": 5
},
"rules": {
"array-bracket-spacing": "error",
"array-callback-return": "error",
"block-spacing": "error",
"brace-style": "error",
"comma-spacing": "error",
"computed-property-spacing": "error",
"curly": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"func-call-spacing": "error",
"indent": [
"error",
2
],
"key-spacing": "error",
"keyword-spacing": "error",
"linebreak-style": "error",
"lines-between-class-members": "error",
"max-len": [
"warn",
{
"code": 110
}
],
"no-array-constructor": "error",
"no-console": "error",
"no-multi-spaces": "error",
"no-multiple-empty-lines": [
"error",
{
"max": 1
}
],
"no-param-reassign": "error",
"no-shadow": "error",
"no-spaced-func": "error",
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-void": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": [
"error",
"always",
{
"objectsInObjects": false
}
],
"padded-blocks": [
"error",
"never"
],
"quotes": [
"error",
"double",
{
"avoidEscape": true
}
],
"semi": [
"error",
"always"
],
"semi-spacing": "error",
"space-before-blocks": "error",
"space-before-function-paren": [
"error",
"never"
],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": [
"error",
"always",
{
"markers": [
"="
],
"exceptions": [
"-"
]
}
],
"strict": "error",
"switch-colon-spacing": "error",
"yoda": "error"
}
}

View File

@@ -1,85 +0,0 @@
env:
browser: true
es6: false
extends: "eslint:recommended"
globals:
$: readonly
App: readonly
AmsifySuggestags: readonly
annotator: readonly
c3: readonly
CKEDITOR: readonly
L: readonly
Turbolinks: readonly
parserOptions:
ecmaVersion: 5
rules:
array-bracket-spacing: error
array-callback-return: error
block-spacing: error
brace-style: error
comma-spacing: error
computed-property-spacing: error
curly: error
dot-notation: error
eol-last: error
eqeqeq:
- error
- always
- "null": ignore
func-call-spacing: error
indent:
- error
- 2
key-spacing: error
keyword-spacing: error
linebreak-style: error
lines-between-class-members: error
max-len:
- warn
- code: 110
no-array-constructor: error
no-console: error
no-multi-spaces: error
no-multiple-empty-lines:
- error
- max: 1
no-param-reassign: error
no-shadow: error
no-spaced-func: error
no-tabs: error
no-trailing-spaces: error
no-void: error
no-whitespace-before-property: error
object-curly-spacing:
- error
- always
- objectsInObjects: false
padded-blocks:
- error
- never
quotes:
- error
- double
- avoidEscape: true
semi:
- error
- always
semi-spacing: error
space-before-blocks: error
space-before-function-paren:
- error
- never
space-in-parens: error
space-infix-ops: error
space-unary-ops: error
spaced-comment:
- error
- always
- markers:
- "="
exceptions:
- "-"
strict: error
switch-colon-spacing: error
yoda: error

22
.github/workflows/linters.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: linters
on: [pull_request]
jobs:
linters:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- run: |
git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/*
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup NPM
uses: actions/setup-node@v1
- name: Install eslint
run: npm install --global eslint@6.0.1
- name: Run Pronto
run: |
PRONTO_PULL_REQUEST_ID="$(jq --raw-output .number "$GITHUB_EVENT_PATH")" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}

View File

@@ -1,11 +0,0 @@
rubocop:
config_file: .rubocop.yml
version: 0.91.0
scss:
config_file: .scss-lint.yml
erblint:
enabled: true
config_file: .erb-lint.yml
eslint:
enabled: true
config_file: .eslintrc.yml

4
.pronto.yml Normal file
View File

@@ -0,0 +1,4 @@
rubocop:
suggestions: true
severities:
refactor: info

View File

@@ -34,7 +34,7 @@ If you'd like us to review your pull request in good spirits, please follow our
* Include specs to test any changes you've made * Include specs to test any changes you've made
* Our CI will check whether the rest of the application is still working properly; check its build and make sure all tests are passing * Our CI will check whether the rest of the application is still working properly; check its build and make sure all tests are passing
* Your pull request will be automatically reviewed by Hound CI; fix any issues it reports * Run `bundle exec pronto run` and fix any issues it reports; these issues will also be automatically reported on the pull request
* Follow [the seven rules of a great commit message](https://chris.beams.io/posts/git-commit/) * Follow [the seven rules of a great commit message](https://chris.beams.io/posts/git-commit/)
When we review your pull request and ask for changes, if you're proficient using `git rebase` edit existing commits instead of adding new ones. If you aren't proficient with `git rebase`, ignore this point. When we review your pull request and ask for changes, if you're proficient using `git rebase` edit existing commits instead of adding new ones. If you aren't proficient with `git rebase`, ignore this point.

View File

@@ -34,7 +34,7 @@ Si quieres que revisemos tu código con una sonrisa, por favor sigue nuestras co
* Incluye tests para los cambios que hayas hecho * Incluye tests para los cambios que hayas hecho
* Los tests se ejecutarán automáticamente para comprobar que el resto de la aplicación sigue funcionando; asegúrate de que los tests pasan * Los tests se ejecutarán automáticamente para comprobar que el resto de la aplicación sigue funcionando; asegúrate de que los tests pasan
* Tus cambios serán revisados automáticamente por Hound CI; arregla los problemas de los que informa (si es que hay alguno) * Ejecuta `bundle exec pronto run` y arregla los problemas de los que informe (si es que hay alguno)
* Sigue [las siete reglas para un gran mensaje de commit](https://chris.beams.io/posts/git-commit/) * Sigue [las siete reglas para un gran mensaje de commit](https://chris.beams.io/posts/git-commit/)
Cuando revisemos tu código y te pidamos que cambies alguna cosa, si tienes experiencia con `git rebase` edita los commits existentes en vez de añadir más. Si no tienes experiencia con `git rebase`, puedes saltarte este punto. Cuando revisemos tu código y te pidamos que cambies alguna cosa, si tienes experiencia con `git rebase` edita los commits existentes en vez de añadir más. Si no tienes experiencia con `git rebase`, puedes saltarte este punto.

View File

@@ -102,6 +102,11 @@ group :development do
gem "erb_lint", "~> 0.0.35", require: false gem "erb_lint", "~> 0.0.35", require: false
gem "github_changelog_generator", "~> 1.15.2" gem "github_changelog_generator", "~> 1.15.2"
gem "mdl", "~> 0.11.0", require: false gem "mdl", "~> 0.11.0", require: false
gem "pronto", "~> 0.11.0"
gem "pronto-erb_lint", "~> 0.1.5"
gem "pronto-eslint", "~> 0.11.0"
gem "pronto-rubocop", "~> 0.11.0"
gem "pronto-scss", "~> 0.11.0"
gem "rubocop", "~> 0.91.0", require: false gem "rubocop", "~> 0.91.0", require: false
gem "rubocop-performance", "~> 1.7.1", require: false gem "rubocop-performance", "~> 1.7.1", require: false
gem "rubocop-rails", "~> 2.6.0", require: false gem "rubocop-rails", "~> 2.6.0", require: false

View File

@@ -218,6 +218,10 @@ GEM
smart_properties smart_properties
errbase (0.0.3) errbase (0.0.3)
erubi (1.9.0) erubi (1.9.0)
eslintrb (2.1.0)
execjs
multi_json (>= 1.3)
rake
execjs (2.7.0) execjs (2.7.0)
factory_bot (4.8.2) factory_bot (4.8.2)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@@ -226,10 +230,13 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
faker (1.8.7) faker (1.8.7)
i18n (>= 0.7) i18n (>= 0.7)
faraday (1.0.1) faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-http-cache (2.2.0) faraday-http-cache (2.2.0)
faraday (>= 0.8) faraday (>= 0.8)
faraday-net_http (1.0.1)
ffi (1.13.1) ffi (1.13.1)
font-awesome-sass (5.15.1) font-awesome-sass (5.15.1)
sassc (>= 1.11) sassc (>= 1.11)
@@ -252,6 +259,9 @@ GEM
rainbow (>= 2.2.1) rainbow (>= 2.2.1)
rake (>= 10.0) rake (>= 10.0)
retriable (~> 3.0) retriable (~> 3.0)
gitlab (4.17.0)
httparty (~> 0.18)
terminal-table (~> 1.5, >= 1.5.1)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
globalize (5.3.0) globalize (5.3.0)
@@ -272,7 +282,7 @@ GEM
highline (2.0.3) highline (2.0.3)
html_tokenizer (0.0.7) html_tokenizer (0.0.7)
htmlentities (4.3.4) htmlentities (4.3.4)
httparty (0.17.0) httparty (0.18.1)
mime-types (~> 3.0) mime-types (~> 3.0)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpi (2.4.5) httpi (2.4.5)
@@ -349,7 +359,7 @@ GEM
method_source (1.0.0) method_source (1.0.0)
mime-types (3.3.1) mime-types (3.3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512) mime-types-data (3.2020.1104)
mimemagic (0.3.5) mimemagic (0.3.5)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
@@ -377,7 +387,7 @@ GEM
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 3) rack (>= 1.2, < 3)
octokit (4.18.0) octokit (4.20.0)
faraday (>= 0.9) faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3) sawyer (~> 0.8.0, >= 0.5.3)
omniauth (1.9.1) omniauth (1.9.1)
@@ -417,6 +427,26 @@ GEM
pg_search (2.3.4) pg_search (2.3.4)
activerecord (>= 5.2) activerecord (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
pronto (0.11.0)
gitlab (~> 4.4, >= 4.4.0)
httparty (>= 0.13.7)
octokit (~> 4.7, >= 4.7.0)
rainbow (>= 2.2, < 4.0)
rexml (~> 3.2)
rugged (>= 0.23.0, < 1.1.0)
thor (>= 0.20.3, < 2.0)
pronto-erb_lint (0.1.5)
erb_lint (~> 0.0.24)
pronto (> 0.9.0)
pronto-eslint (0.11.0)
eslintrb (~> 2.0, >= 2.0.0)
pronto (~> 0.11.0)
pronto-rubocop (0.11.0)
pronto (~> 0.11.0)
rubocop (>= 0.49.1, < 1.0)
pronto-scss (0.11.0)
pronto (~> 0.11.0)
scss_lint (~> 0.43, >= 0.43.0)
public_suffix (4.0.6) public_suffix (4.0.6)
puma (4.3.6) puma (4.3.6)
nio4r (~> 2.0) nio4r (~> 2.0)
@@ -514,7 +544,9 @@ GEM
rubocop-rspec (1.41.0) rubocop-rspec (1.41.0)
rubocop (>= 0.68.1) rubocop (>= 0.68.1)
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)
ruby2_keywords (0.0.4)
rubyzip (2.3.0) rubyzip (2.3.0)
rugged (1.0.1)
rvm1-capistrano3 (1.4.0) rvm1-capistrano3 (1.4.0)
capistrano (~> 3.0) capistrano (~> 3.0)
sshkit (>= 1.2) sshkit (>= 1.2)
@@ -584,7 +616,7 @@ GEM
unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (~> 1.1, >= 1.1.1)
terrapin (0.6.0) terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0) climate_control (>= 0.0.3, < 1.0)
thor (1.0.1) thor (1.1.0)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
tins (1.25.0) tins (1.25.0)
@@ -704,6 +736,11 @@ DEPENDENCIES
paranoia (~> 2.4.2) paranoia (~> 2.4.2)
pg (~> 1.0.0) pg (~> 1.0.0)
pg_search (~> 2.3.4) pg_search (~> 2.3.4)
pronto (~> 0.11.0)
pronto-erb_lint (~> 0.1.5)
pronto-eslint (~> 0.11.0)
pronto-rubocop (~> 0.11.0)
pronto-scss (~> 0.11.0)
puma (~> 4.3.6) puma (~> 4.3.6)
rails (= 5.2.4.4) rails (= 5.2.4.4)
rails-assets-leaflet! rails-assets-leaflet!
@@ -740,4 +777,4 @@ DEPENDENCIES
wkhtmltopdf-binary (~> 0.12.4) wkhtmltopdf-binary (~> 0.12.4)
BUNDLED WITH BUNDLED WITH
1.17.1 1.17.2

View File

@@ -15,7 +15,6 @@ Citizen Participation and Open Government Application
[![Coverage Status](https://coveralls.io/repos/github/consul/consul/badge.svg)](https://coveralls.io/github/consul/consul?branch=master) [![Coverage Status](https://coveralls.io/repos/github/consul/consul/badge.svg)](https://coveralls.io/github/consul/consul?branch=master)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/consul/localized.svg)](https://crowdin.com/project/consul) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/consul/localized.svg)](https://crowdin.com/project/consul)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](http://www.gnu.org/licenses/agpl-3.0) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
[![Accessibility conformance](https://img.shields.io/badge/accessibility-WAI:AA-green.svg)](https://www.w3.org/WAI/eval/Overview) [![Accessibility conformance](https://img.shields.io/badge/accessibility-WAI:AA-green.svg)](https://www.w3.org/WAI/eval/Overview)
[![A11y issues checked with Rocket Validator](https://rocketvalidator.com/badges/checked_with_rocket_validator.svg?url=https://rocketvalidator.com)](https://rocketvalidator.com/opensource) [![A11y issues checked with Rocket Validator](https://rocketvalidator.com/badges/checked_with_rocket_validator.svg?url=https://rocketvalidator.com)](https://rocketvalidator.com/opensource)
@@ -39,7 +38,7 @@ You can access the main website of the project at [http://consulproject.org](htt
**NOTE**: For more detailed instructions check the [docs](https://docs.consulproject.org) **NOTE**: For more detailed instructions check the [docs](https://docs.consulproject.org)
Prerequisites: install git, Ruby 2.6.6, Node.js and PostgreSQL (>=9.4). Prerequisites: install git, Ruby 2.6.6, CMake, pkg-config, Node.js and PostgreSQL (>=9.4).
```bash ```bash
git clone https://github.com/consul/consul.git git clone https://github.com/consul/consul.git

View File

@@ -36,7 +36,7 @@ Puedes acceder a la página principal del proyecto en [http://consulproject.org]
**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consulproject.org) **NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consulproject.org)
Prerequisitos: tener instalado git, Ruby 2.6.6, Node.js y PostgreSQL (9.4 o superior). Prerequisitos: tener instalado git, Ruby 2.6.6, CMake, pkg-config, Node.js y PostgreSQL (9.4 o superior).
```bash ```bash
git clone https://github.com/consul/consul.git git clone https://github.com/consul/consul.git

View File

@@ -0,0 +1,5 @@
if Rails.env.development?
BetterHtml.configure do |config|
config.template_exclusion_filter = proc { |filename| true }
end
end