Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add rubocop github ci to prevent no localize variables #480

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
cf9b4ef
Merge branch 'master' into development
syphax-bouazzouni Dec 20, 2023
5c684ee
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Dec 20, 2023
d877cfc
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Dec 24, 2023
d18a700
Feauture: Update admin page and fix google analytics (#422)
syphax-bouazzouni Dec 28, 2023
b151193
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Dec 28, 2023
b498460
Fix: Google Analytics 4 tag (#424)
syphax-bouazzouni Dec 28, 2023
83225a6
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Dec 30, 2023
b5369a6
Feature: add SPARQL endpoint UI (#427)
syphax-bouazzouni Dec 30, 2023
7468b6f
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Dec 31, 2023
3c3ab7b
Feature: add satistics page (#428)
syphax-bouazzouni Dec 31, 2023
5bb4876
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Jan 1, 2024
f126613
Fix: remove old JS dependecies (#429)
syphax-bouazzouni Jan 1, 2024
d6d4688
Merge branch 'development' of github.com:ontoportal-lirmm/bioportal_w…
syphax-bouazzouni Jan 1, 2024
3304368
Feature: add synchronize groups to slices button in admin page (#418)
SirineMhedhbi Jan 2, 2024
f910faf
Feature: Add icons to display orcid, and affiliations in agent toolti…
Bilelkihal Jan 2, 2024
49f9885
Feature : create a new component to display tree views (#307)
SirineMhedhbi Jan 3, 2024
fe4b7d8
Feature: update Widgets section design to remove thickbox (#430)
syphax-bouazzouni Jan 3, 2024
ee57f57
Feature: Remove Facebox from instances, admin submissions, categorie…
syphax-bouazzouni Jan 5, 2024
5e49913
Merge branch 'master' into development
syphax-bouazzouni Jan 5, 2024
cc64185
Feature: Update search page design (#412)
Bilelkihal Jan 5, 2024
898c390
fix the display of obsolete class (#419)
SirineMhedhbi Jan 8, 2024
d73d2d2
Fix: new Search page issues (#436)
Bilelkihal Jan 8, 2024
f99664c
Fix: home page issues (#417)
Bilelkihal Jan 12, 2024
20c7341
Fix: content and aesthetics globally to add help text and action icon…
SirineMhedhbi Jan 16, 2024
6fb3872
Feature: Update recommender page design (#433)
Bilelkihal Jan 17, 2024
d64cdb5
Feature: Add URL resolvability checker (#463)
syphax-bouazzouni Jan 22, 2024
4da4e6d
Merge branch 'master' into development
syphax-bouazzouni Jan 24, 2024
bc38e3d
fix SKOS collections colors not removing all dots (#465)
syphax-bouazzouni Jan 24, 2024
299a2ee
Fix: Add slider component to recommender page (#466)
Bilelkihal Jan 25, 2024
80cfb85
Feature: Add keywords tooltip in Recommender page (#471)
Bilelkihal Jan 29, 2024
a89eef7
Fix: metadata exporter to different formats (CSV, xml, json and ntrip…
syphax-bouazzouni Jan 29, 2024
053a989
Feature: enable multilingual to the properties tab (#470)
syphax-bouazzouni Jan 29, 2024
44fc8d3
add rubocop github ci
SirineMhedhbi Jan 31, 2024
dcff9d8
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
45c5492
Update rubocop.yml to add bundle cache
syphax-bouazzouni Jan 31, 2024
8b4b730
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
dcefca7
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
5b51bde
fix rubocop ci set ruby action version
syphax-bouazzouni Jan 31, 2024
57c12bd
Update rubocop.yml to set ruby version to 3.1.0
syphax-bouazzouni Jan 31, 2024
1f9cc71
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
62a753e
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
95a420b
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
80a792f
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
00d5339
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
f785513
Update rubocop.yml
syphax-bouazzouni Jan 31, 2024
39cfe59
update rubocop file
SirineMhedhbi Feb 2, 2024
ab95332
Update rubocop.yml
syphax-bouazzouni Feb 2, 2024
60ee1ba
Update rubocop.yml
syphax-bouazzouni Feb 2, 2024
ec4a212
Update rubocop.yml
syphax-bouazzouni Feb 2, 2024
eeabe35
Add a rule to detect non-localized strings.
SirineMhedhbi Feb 21, 2024
19a4496
add haml-lint to detect no localized stings in haml files
syphax-bouazzouni Mar 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Linters

on: [push, pull_request]

jobs:
rubocop:
name: RuboCop
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0

- name: Install dependencies
run: gem install rubocop rubocop-rails rubocop-i18n


- name: Run RuboCop
run: rubocop --parallel --format github

haml-lint:
name: HamlLint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install HamlLint
run: gem install haml-lint

- name: Run HamlLint
run: haml-lint -r github
68 changes: 15 additions & 53 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,23 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: "Run local API tests CI"
name: RuboCop

on: [push, pull_request]

on:
push:
pull_request:
types: [ opened, reopened ]
env:
API_URL: http://localhost:9393
REMOTE_API_KEY: 8b5b7825-538d-40e0-9e9e-5ab9274a9aeb
REMOTE_API_URL: https://data.bioontology.org
BIOMIXER_URL: ${{ secrets.BIOMIXER_URL }}
FAIRNESS_URL: ${{ secrets.FAIRNESS_URL }}
ANNOTATOR_URL: ${{ secrets.ANNOTATOR_URL }}
DB_HOST: 127.0.0.1
jobs:
test:
rubocop:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: root
memcached:
image: memcached:1.6
ports:
- 11211:11211

steps:
- name: Checkout code
uses: actions/checkout@v3
# Add or replace dependency steps here
- name: Install Ruby and gems
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.8
bundler-cache: true
ruby-version: 2.7 # You can change this to your preferred Ruby version

- name: Run OntoPortal API
run: bin/run_api -k ${{ env.REMOTE_API_KEY }} -r agroportal -t development -s STY -u ${{ env.REMOTE_API_URL }}
- name: Install RuboCop
run:
gem install rubocop rubocop-rails

# Add or replace database setup steps here
- name: set up config file
run: cp config/database.yml.sample config/database.yml
- name: Set up database schema
run: RAILS_ENV=test bin/rails db:setup
- name: Set up yarn
run: yarn install
# Add or replace test runners here
- name: Run tests
run: COVERAGE=true RAILS_ENV=test bin/rails test -v
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run RuboCop
run: rubocop --parallel --format github
137 changes: 137 additions & 0 deletions .haml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
require:
- './lib/lint/no_localized_string_haml.rb'

linters:
CustomLinter:
enabled: true
include: '**/*.haml'

# Default application configuration that all configurations inherit from.
#
# This is an opinionated list of which hooks are valuable to run and what their
# out of the box settings should be.

# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: false

linters:

MyFirstLinter:
enabled: true

NoPlainTextLinter:
enabled: true

AlignmentTabs:
enabled: true

AltText:
enabled: false

ClassAttributeWithStaticValue:
enabled: true

ClassesBeforeIds:
enabled: true

ConsecutiveComments:
enabled: true
max_consecutive: 1

ConsecutiveSilentScripts:
enabled: true
max_consecutive: 2

EmptyObjectReference:
enabled: true

EmptyScript:
enabled: true

FinalNewline:
enabled: true
present: true

HtmlAttributes:
enabled: true

IdNames:
enabled: true
style: lisp_case

ImplicitDiv:
enabled: true

Indentation:
enabled: true
character: space # or tab
width: 2 # ignored if character == tab

InlineStyles:
enabled: true

InstanceVariables:
enabled: true
file_types: partials
matchers:
all: .*
partials: \A_.*\.haml\z

LeadingCommentSpace:
enabled: true

LineLength:
enabled: true
max: 80

MultilinePipe:
enabled: true

MultilineScript:
enabled: true

NoPlaceholders:
enabled: false

ObjectReferenceAttributes:
enabled: true

RepeatedId:
enabled: true
severity: error

RuboCop:
enabled: true
# Users can ignore cops using this configuration instead of editing their rubocop configuration.
# Mostly there for backward compatibility.
ignored_cops: []

RubyComments:
enabled: true

SpaceBeforeScript:
enabled: true

SpaceInsideHashAttributes:
enabled: true
style: space

TagName:
enabled: true

TrailingEmptyLines:
enabled: true

TrailingWhitespace:
enabled: true

UnnecessaryInterpolation:
enabled: true

UnnecessaryStringOutput:
enabled: true

ViewLength:
enabled: true
max: 100
82 changes: 82 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
AllCops:
NewCops: disable
Exclude:
- db/migrate/**/*
- db/schema.rb
- config/**/*
- script/**/*
- bin/**/*
- test/**/*
- app/admin/**/*
- app/channels/**/*
- app/jobs/**/*
- node_modules/**/*
- Gemfile
- Rakefile
- config.ru

require:
- rubocop-rails
- ./lib/lint/non_localized_string.rb
- rubocop-i18n
Lint/NonLocalizedString:
Enabled: true

Style/Encoding:
Enabled: false

Style/Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false

Style/InlineComment:
Description: 'Avoid inline comments.'
Enabled: false

Layout/LineLength:
Description: 'Limit lines to 100 characters. (Default is 80)'
Max: 100

Style/FrozenStringLiteralComment:
Description: To help transition from Ruby 2.3.0 to Ruby 3.0.
Enabled: false

Style/WordArray:
Description: 'Use %w or %W for arrays of words.'
Enabled: false

# Defaults all strings to double quotes. Less performant, but
# nicer for consistency, and for adding interpolation later.
Style/StringLiterals:
EnforcedStyle: double_quotes

# Prettier hashes.
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table

# No auto-correct for unused block arguments,
# but will still warn.
Lint/UnusedBlockArgument:
AutoCorrect: false

# No auto-correct for unused method arguments,
# but will still warn.
Lint/UnusedMethodArgument:
AutoCorrect: false

Rails/HasAndBelongsToMany:
Enabled: false

Layout/HeredocIndentation:
Enabled: false

Style/MissingRespondToMissing:
Enabled: false

Lint/MissingSuper:
Enabled: true


Rails/I18nLocaleTexts:
Enabled: true
9 changes: 6 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ gem 'terser' #ugilifer replacent
# gem 'duktape'

gem 'bootstrap', '~> 4.2.0'
gem 'chart-js-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'select2-rails'



# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
Expand Down Expand Up @@ -109,6 +108,7 @@ group :development do
# static code analysis
gem 'brakeman', require: false
gem 'rubocop', require: false
gem 'rubocop-rails'
# gem 'i18n-debug'
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[ mri mingw x64_mingw ]
Expand All @@ -118,6 +118,9 @@ group :development do
gem 'i18n-tasks'
gem 'deepl-rb'
gem 'letter_opener_web', '~> 2.0'
gem 'haml-rails'
gem "rubocop-i18n", "~> 3.0"
gem 'haml_lint', require: false
end

group :test, :development do
Expand All @@ -139,4 +142,4 @@ gem "net-http", "~> 0.3.2"



gem "bugsnag", "~> 6.26"
gem "bugsnag", "~> 6.26"
Loading
Loading