Skip to content

Commit

Permalink
Split CI and configure linters for .md, .js, .scss and .erb files (#514)
Browse files Browse the repository at this point in the history
* Split CI and configure linters for .md, .js, .scss and .erb files

* Update README.md
  • Loading branch information
fblupi authored Feb 9, 2024
1 parent c7081df commit 5ac83b9
Show file tree
Hide file tree
Showing 37 changed files with 546 additions and 440 deletions.
2 changes: 2 additions & 0 deletions .csslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--exclude-exts=.min.css
--ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes
30 changes: 30 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---

linters:
ExtraNewline:
enabled: true

FinalNewline:
enabled: true

SpaceAroundErbTag:
enabled: true

AllowedScriptType:
enabled: true
allowed_types:
- text/javascript
- text/template

Rubocop:
enabled: true

rubocop_config:
AllCops:
DisabledByDefault: true

Style/StringLiterals:
EnforcedStyle: double_quotes

Layout/SpaceInsideHashLiteralBraces:
Enabled: true
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/*{.,-}min.js
decidim-*/vendor/**/*.js
**/node_modules/**
bundle.js
karma.conf.js
webpack.config.js
webpack.config.babel.js
entry.test.js
entry.js
*_manifest.js
coverage
vendor/bundle
**/vendor/**/*.js
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@decidim"
}
27 changes: 4 additions & 23 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
<!--
1. Please check if an issue already exists so there are no duplicates
2. Fill out the whole template so we have a good overview on the issue
3. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue
4. Please follow the template, otherwise we'll have to ask you to update it
-->
#### :tophat: User Story

# This is a (Bug Report / Feature Proposal)

#### :tophat: Description
#### :clipboard: Related documentation

For bug reports:
* What went wrong?
* What did you expect should have happened?
* What was the config you used?
* What stacktrace or error message from your provider did you see?

For feature proposals:
* What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
* If there is additional config how would it look
#### :dart: Acceptance criteria


#### :pushpin: Related issues
* #12345

#### :clipboard: Additional Data

* ***Decidim deployment where you found the issue***:
* ***Browser & version***:
* ***Screenshot***:
* ***Error messages***:
* ***URL to reproduce the error***:
File renamed without changes.
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint
on: [push]

env:
RUBY_VERSION: 3.0.2
NODE_VERSION: 16.9.1

jobs:
lint:
name: Lint code
runs-on: ubuntu-20.04
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
RAILS_ENV: test
steps:
- uses: actions/checkout@v2.0.0
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm ci
name: Install JS deps
- run: bundle exec rubocop -P
name: Lint Ruby files
- run: bundle exec mdl *.md
name: Lint Markdown files
- run: bundle exec erblint {decidim-census_sms/,decidim-dataviz/,decidim-ephemeral_participation/,decidim-stats/,decidim-valid_auth/}app/{cells,views}/**/*.erb
name: Lint ERB files
- run: npm run stylelint
name: Lint SCSS files
- run: npm run lint
name: Lint JS files
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: "[CI] Decidim"
name: Test
on: [push]

env:
RUBY_VERSION: 3.0.2
NODE_VERSION: 16.9.1

jobs:
tests:
name: Tests
test:
name: Test
runs-on: ubuntu-20.04
services:
postgres:
Expand Down Expand Up @@ -46,8 +46,6 @@ jobs:
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: 119.0.6045.105
- run: bundle exec rubocop -P
name: Lint Ruby files
- run: bundle exec rake db:test:prepare
name: Setup database
- name: Precompile assets
Expand Down
13 changes: 13 additions & 0 deletions .mdl_style.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

all

exclude_rule "first-line-h1"

exclude_rule "line-length"

exclude_rule "no-bare-urls"

exclude_rule "no-inline-html"

rule "no-trailing-punctuation", punctuation: ".,;:!"
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style ".mdl_style.rb"
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ This code of conduct applies both within project spaces and in public spaces whe

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
12 changes: 0 additions & 12 deletions ISSUE_TEMPLATE.md

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

---

Citizen Participation and Open Government Application.
Citizen Participation and Open Government Application.

[![Build Status](https://github.com/AjuntamentdeBarcelona/decidim-barcelona/actions/workflows/decidim_ci.yml/badge.svg)](https://github.com/AjuntamentdeBarcelona/decidim-barcelona/actions/workflows/decidim_ci.yml)
[![[CI] Lint](https://github.com/AjuntamentdeBarcelona/decidim-barcelona/actions/workflows/lint.yml/badge.svg)](https://github.com/AjuntamentdeBarcelona/decidim-barcelona/actions/workflows/lint.yml)
[![[CI] Test](https://github.com/AjuntamentdeBarcelona/decidim-barcelona/actions/workflows/test.yml/badge.svg)](https://github.com/AjuntamentdeBarcelona/decidim-barcelona/actions/workflows/test.yml)
[![Code Climate](https://codeclimate.com/github/AjuntamentdeBarcelona/decidim-barcelona/badges/gpa.svg)](https://codeclimate.com/github/AjuntamentdeBarcelona/decidim-barcelona)

This is the opensource code repository for "decidim-barcelona", based on [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
Expand All @@ -15,7 +16,7 @@ This is the opensource code repository for "decidim-barcelona", based on [Decidi

You can setup everything with Docker & Docker compose, run:

```
```bash
docker-compose build
docker-compose run --rm app bundle exec rake db:create db:schema:load db:seed
docker-compose up
Expand Down
22 changes: 13 additions & 9 deletions app/packs/stylesheets/_global_accountability.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
max-width: 600px;
padding-bottom: 2rem;
}

.centered--text.text-center {
text-align: center;
}
Expand All @@ -31,15 +32,16 @@
text-align: left;

h4 {
padding: 1.5rem 1.5rem 1rem 1.5rem;
padding: 1.5rem 1.5rem 1rem;
border-bottom: 1px solid $medium-gray;

.icon {
margin-right: 0.25rem;
margin-right: .25rem;
}
}

.card__content {
padding: 0 1.5rem 1.5rem 1.5rem;
padding: 0 1.5rem 1.5rem;

ul {
list-style: none;
Expand All @@ -61,8 +63,8 @@
}
}

.card--mini .card__content{
padding: 1.5rem 0.5rem;
.card--mini .card__content {
padding: 1.5rem .5rem;
}

.accountability--graphic {
Expand All @@ -75,13 +77,15 @@
.programme--section {
margin-bottom: 1.5rem;
}

.icon {
margin-right: 0.25rem;
margin-right: .25rem;
fill: $secondary;
}
}
}
}

.accountability .categories .categories--group .card__link .category--scope--line {
background-color: white;
border: 1px solid #ddd;
Expand All @@ -93,7 +97,7 @@

strong {
font-size: 1.5rem;
padding-bottom: 0.5rem;
padding-bottom: .5rem;
display: block;
}

Expand Down Expand Up @@ -126,11 +130,11 @@
}

.accountability .categories .categories--group .card__link .category--line .category--count {
color: #ABA5B3;
color: #aba5b3;
}

.accountability .categories .categories--group .card__link .category--line strong {
color: #182B71;
color: #182b71;
}

.accountability .categories .categories--group .category--title p.heading3 {
Expand Down
2 changes: 1 addition & 1 deletion app/packs/stylesheets/decidim/decidim_application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
// By default this is empty.

@import "stylesheets/barcelona";
@import "stylesheets/global_accountability";
@import "stylesheets/global_accountability";
Loading

0 comments on commit 5ac83b9

Please sign in to comment.