Merge pull request #5545 from consuldemocracy/linters_in_github_actions

Run every linter separately in Github Actions
This commit is contained in:
Javi Martín
2024-06-18 19:33:53 +02:00
committed by GitHub
13 changed files with 1102 additions and 88 deletions

View File

@@ -1,5 +1,7 @@
---
EnableDefaultLinters: false
exclude:
- '**/vendor/**/*'
linters:
AllowedScriptType:
enabled: true
@@ -9,6 +11,16 @@ linters:
enabled: true
ErbSafety:
enabled: true
exclude:
- app/components/budgets/investments/content_blocks_component.html.erb
- app/components/layout/footer_component.html.erb
- app/components/layout/social_component.html.erb
- app/components/layout/subnavigation_component.html.erb
- app/components/layout/top_links_component.html.erb
- app/views/admin/site_customization/content_blocks/index.html.erb
- app/views/layouts/application.html.erb
- app/views/layouts/dashboard.html.erb
- app/views/layouts/devise.html.erb
ExtraNewline:
enabled: true
FinalNewline:

View File

@@ -1,4 +1,9 @@
{
"ignorePatterns": [
"app/assets/javascripts/ckeditor/config.js",
"node_modules/",
"vendor/"
],
"env": {
"browser": true,
"es6": false

View File

@@ -1,9 +1,25 @@
name: linters
on: [pull_request]
permissions:
contents: read
jobs:
linters:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: RuboCop
run: bundle exec rubocop --fail-level convention --display-only-fail-level-offenses -f github
- name: ERB Lint
run: bundle exec erblint .
- name: ESLint
run: npx eslint . --quiet
- name: Stylelint
run: npx stylelint app/assets/stylesheets
name: ${{ matrix.name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -20,10 +36,5 @@ jobs:
node-version-file: ".node-version"
- name: Install node packages
run: npm clean-install
- name: Run pronto
run: |
if [[ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.event.pull_request.base.repo.full_name }} && ${{ github.actor }} != dependabot* ]]; then
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 }}
else
bundle exec pronto run --exit-code -c origin/${{ github.base_ref }}
fi
- name: ${{ matrix.name }}
run: ${{ matrix.run }}

25
.github/workflows/pronto.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: pronto
on: [pull_request]
jobs:
pronto:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot'
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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@v4
with:
cache: "npm"
node-version-file: ".node-version"
- name: Install node packages
run: npm clean-install
- 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

@@ -11,6 +11,7 @@ AllCops:
Exclude:
- "db/schema.rb"
- "app/lib/ckeditor/backend/active_storage.rb"
- "vendor/**/*"
DisabledByDefault: true
Bundler/DuplicatedGem:

View File

@@ -89,3 +89,14 @@ rules:
"@stylistic/color-hex-case": "lower"
"@stylistic/number-leading-zero": "always"
"@stylistic/selector-list-comma-newline-after": always
overrides:
- files: app/assets/stylesheets/datepicker_overrides.scss
rules:
scss/selector-no-redundant-nesting-selector: null
- files: app/assets/stylesheets/legislation_process.scss
rules:
max-nesting-depth: 8
selector-max-compound-selectors: 8
- files: app/assets/stylesheets/shared/social_share.scss
rules:
selector-class-pattern: "^([a-z][a-z0-9]*)((-|_)[a-z0-9]+)*$"

View File

@@ -20,11 +20,11 @@
pass += possible_chars.charAt(Math.floor(Math.random() * possible_chars.length)).toUpperCase();
}
for (var i = 0; i < password_complexity.digit; i++) {
for (var j = 0; j < password_complexity.digit; j++) {
pass += possible_digits.charAt(Math.floor(Math.random() * possible_digits.length));
}
for (var i = 0; i < password_complexity.symbol; i++) {
for (var k = 0; k < password_complexity.symbol; k++) {
pass += possible_symbols.charAt(Math.floor(Math.random() * possible_symbols.length));
}

View File

@@ -1284,35 +1284,6 @@ table {
}
}
.social-share-button .ssb-icon {
background-image: none;
color: #fff;
height: $icon-width;
line-height: $icon-width;
text-align: center;
width: $icon-width;
&::before {
font-size: calc(#{$icon-width} / 2);
margin-right: 0;
}
&:hover,
&:focus {
background: #fff;
}
}
.ssb-twitter {
@include has-fa-icon(twitter, brands);
background: #45b0e3;
&:hover,
&:focus {
color: #40a2d1;
}
}
.button.button-facebook {
@include has-fa-icon(facebook-f, brands);
background: #ebeef4;
@@ -1323,16 +1294,6 @@ table {
}
}
.ssb-facebook {
@include has-fa-icon(facebook-f, brands);
background: #3b5998;
&:hover,
&:focus {
color: #354f88;
}
}
.button.button-google {
@include has-fa-icon(google, brands);
background: #fcedea;
@@ -1353,42 +1314,6 @@ table {
}
}
.ssb-telegram {
@include has-fa-icon(telegram-plane, brands);
background: #08c;
&:hover,
&:focus {
color: #40a2d1;
}
}
.ssb-whatsapp_app {
@include has-fa-icon(whatsapp, brands);
background: #43d854;
&:hover,
&:focus {
color: #43d854;
}
}
@include breakpoint(medium) {
.ssb-telegram,
.ssb-whatsapp_app {
display: none !important;
}
}
.share-supported {
text-align: center;
.social-share-button {
display: inline-block;
}
}
// 14. Verification
// ----------------

View File

@@ -0,0 +1,75 @@
.social-share-button .ssb-icon {
background-image: none;
color: #fff;
height: $icon-width;
line-height: $icon-width;
text-align: center;
width: $icon-width;
&::before {
font-size: calc(#{$icon-width} / 2);
margin-right: 0;
}
&:hover,
&:focus {
background: #fff;
}
}
.ssb-twitter {
@include has-fa-icon(twitter, brands);
background: #45b0e3;
&:hover,
&:focus {
color: #40a2d1;
}
}
.ssb-facebook {
@include has-fa-icon(facebook-f, brands);
background: #3b5998;
&:hover,
&:focus {
color: #354f88;
}
}
.ssb-telegram {
@include has-fa-icon(telegram-plane, brands);
background: #08c;
&:hover,
&:focus {
color: #40a2d1;
}
}
.ssb-whatsapp_app {
@include has-fa-icon(whatsapp, brands);
background: #43d854;
&:hover,
&:focus {
color: #43d854;
}
}
@include breakpoint(medium) {
.ssb-telegram,
.ssb-whatsapp_app {
display: none !important;
}
}
.share-supported {
text-align: center;
.social-share-button {
display: inline-block;
}
}

View File

@@ -64,15 +64,15 @@
<% stats.all_phases.each do |phase| %>
<td id="total_participants_<%= phase %>_phase_heading_<%= heading.id %>"
class="border-left text-center">
<%= stats.headings[heading.id]["total_participants_#{phase}_phase".to_sym] %>
<%= stats.headings[heading.id][:"total_participants_#{phase}_phase"] %>
</td>
<td id="percentage_participants_<%= phase %>_phase_heading_<%= heading.id %>"
class="border-left border-right text-center">
<%= number_to_stats_percentage(stats.headings[heading.id]["percentage_participants_#{phase}_phase".to_sym]) %>
<%= number_to_stats_percentage(stats.headings[heading.id][:"percentage_participants_#{phase}_phase"]) %>
</td>
<td id="percentage_district_population_<%= phase %>_phase_heading_<%= heading.id %>"
class="text-center border-right">
<%= number_to_stats_percentage(stats.headings[heading.id]["percentage_district_population_#{phase}_phase".to_sym]) %>
<%= number_to_stats_percentage(stats.headings[heading.id][:"percentage_district_population_#{phase}_phase"]) %>
</td>
<% end %>
</tr>

View File

@@ -1,5 +1,5 @@
<% if current_user.poll_officer? %>
<div id="officing-booth" class="callout info">
<%= t("admin.officing_booth.title", booth: try(:current_booth)&.location) %>
<%= t("admin.officing_booth.title", booth: current_booth&.location) %>
</div>
<% end %>

948
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@
},
"devDependencies": {
"@stylistic/stylelint-plugin": "^2.1.0",
"eslint": "^8.57.0",
"postcss-scss": "^4.0.9",
"stylelint": "^16.3.1",
"stylelint-order": "^6.0.4",