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

Vaga desenvolvedor #44

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5536045
feat: improve specs for lib
llpereiras Jan 18, 2024
69a712a
feat: implement show action and remove unused actions
llpereiras Jan 18, 2024
c919d64
feat: refactor of importa arquivos and fix specs
llpereiras Jan 18, 2024
996f8e5
Merge pull request #1 from llpereiras/ft/improve-specs
llpereiras Jan 18, 2024
34672cc
feat: improve autoload
llpereiras Jan 18, 2024
0b002ea
feat: improve autoload of lib folder
llpereiras Jan 18, 2024
2c54a7b
Merge pull request #2 from llpereiras/ft/improve-autoload
llpereiras Jan 18, 2024
bcf1998
feat: upgrade ruby to 3.1
llpereiras Jan 18, 2024
761e9a4
feat: upgrade rails to 7.0
llpereiras Jan 18, 2024
5297b42
fix: actions cache error
llpereiras Jan 18, 2024
0681216
Merge pull request #3 from llpereiras/ft/upgrade-ruby-3.1_upgrade-rai…
llpereiras Jan 18, 2024
f785361
feat: add database null coluns and strict load
llpereiras Jan 18, 2024
1af44c2
Merge pull request #4 from llpereiras/ft/add-database-verifications
llpereiras Jan 18, 2024
f222262
feat: remove unused code
llpereiras Jan 18, 2024
053c237
feat: improve docker run
llpereiras Jan 18, 2024
4cf0acb
Merge pull request #5 from llpereiras/ft/cleanup-docker-improve
llpereiras Jan 18, 2024
3e2a431
feat: improve serializer
llpereiras Jan 18, 2024
679e708
feat: add faker and improve factories
llpereiras Jan 18, 2024
2f6f862
Merge pull request #6 from llpereiras/ft/improve-serializer
llpereiras Jan 18, 2024
d1a5596
feat: add rake to import metas
llpereiras Jan 18, 2024
862522c
feat: improve docker and add docker-compose
llpereiras Jan 18, 2024
82ec10c
Merge pull request #7 from llpereiras/ft/add-rake-and-docker-compose
llpereiras Jan 18, 2024
868503e
feat: implement not found check and default response
llpereiras Jan 18, 2024
5caed2f
Merge pull request #8 from llpereiras/ft/add-not-found
llpereiras Jan 18, 2024
c05ef5d
feat: add authentication
llpereiras Jan 18, 2024
611e3b7
Merge pull request #9 from llpereiras/ft/add-authentication
llpereiras Jan 18, 2024
418a177
feat: improve specs and add specs for serializers
llpereiras Jan 19, 2024
19333f9
Merge pull request #10 from llpereiras/ft/check-response-improve-seri…
llpereiras Jan 19, 2024
3d95a64
feat: add rubocop start config and todo file
llpereiras Jan 19, 2024
d55ed56
fix: rubocop issue
llpereiras Jan 19, 2024
b30076a
feat: add quality job
llpereiras Jan 19, 2024
16331c1
Merge pull request #11 from llpereiras/ft/add-rubocop
llpereiras Jan 19, 2024
5ac931a
feat: add simplecov
llpereiras Jan 19, 2024
16093a3
feat: refactor class and improve specs
llpereiras Jan 19, 2024
10f32f5
Merge pull request #12 from llpereiras/ft/add-coverage
llpereiras Jan 19, 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
20 changes: 18 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ name: Main
on: [push]

jobs:
quality:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
bundler-cache: true

- name: Run rubocop
run: |
bundle exec rubocop

test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -17,7 +33,7 @@ jobs:
ci_node_index: [0, 1]
env:
RAILS_ENV: test
GEMFILE_RUBY_VERSION: 2.6.9
GEMFILE_RUBY_VERSION: 3.1.2

steps:
- uses: actions/checkout@v2
Expand All @@ -26,7 +42,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
# Not needed with a .ruby-version file
ruby-version: 2.6.9
ruby-version: 3.1.2
# runs 'bundle install' and caches installed gems automatically
bundler-cache: true

Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
log/*
tmp/*
db/development.sqlite3
db/test.sqlite3
db/development.sqlite3*
db/test.sqlite3*

coverage/*
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--require spec_helper
--require rails_helper
--format documentation
--colour
12 changes: 12 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
inherit_from: .rubocop_todo.yml

AllCops:
NewCops: enable
SuggestExtensions: false

Style/NumericLiterals:
Exclude:
- db/schema.rb

Methods/BlockLength:
Max: 100
244 changes: 244 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-01-19 00:20:16 UTC using RuboCop version 1.57.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'lib/importa_arquivos.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLines:
Exclude:
- 'config/environments/development.rb'
- 'db/migrate/20190905171918_create_resultados.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: around, only_before
Layout/EmptyLinesAroundAccessModifier:
Exclude:
- 'app/controllers/clientes_controller.rb'
- 'app/controllers/resultados_controller.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'db/migrate/20190905171918_create_resultados.rb'
- 'db/schema.rb'
- 'spec/controllers/clientes_controller_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: normal, indented_internal_methods
Layout/IndentationConsistency:
Exclude:
- 'app/controllers/clientes_controller.rb'
- 'app/controllers/resultados_controller.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Width, AllowedPatterns.
Layout/IndentationWidth:
Exclude:
- 'app/controllers/clientes_controller.rb'
- 'app/controllers/resultados_controller.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Layout/LeadingEmptyLines:
Exclude:
- 'app/controllers/concerns/AuthorizeApiRequest.rb'
- 'app/serializers/application_serializer.rb'
- 'lib/tasks/import.rake'
- 'spec/support/secured_behavior.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBrackets: space, no_space
Layout/SpaceInsideArrayLiteralBrackets:
Exclude:
- 'config/environments/production.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideBlockBraces:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 26
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
Exclude:
- 'spec/controllers/calculos_controller_spec.rb'
- 'spec/controllers/clientes_controller_spec.rb'
- 'spec/controllers/resultados_controller_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: final_newline, final_blank_line
Layout/TrailingEmptyLines:
Exclude:
- 'app/serializers/application_serializer.rb'
- 'lib/tasks/import.rake'
- 'spec/support/secured_behavior.rb'

# Offense count: 7
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 80

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'app/controllers/concerns/AuthorizeApiRequest.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/BlockComments:
Exclude:
- 'spec/spec_helper.rb'

# Offense count: 9
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# AllowedMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/controllers/calculos_controller_spec.rb'
- 'spec/controllers/clientes_controller_spec.rb'
- 'spec/controllers/resultados_controller_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/DefWithParentheses:
Exclude:
- 'lib/resultados.rb'

# Offense count: 19
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Style/ExpandPathArguments:
Exclude:
- 'bin/rails'
- 'bin/rake'
- 'spec/rails_helper.rb'

# Offense count: 61
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'config/environments/production.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
# SupportedShorthandSyntax: always, never, either, consistent
Style/HashSyntax:
Exclude:
- 'app/controllers/calculos_controller.rb'

# Offense count: 3
Style/MixinUsage:
Exclude:
- 'bin/setup'
- 'bin/update'
- 'spec/lib/importa_arquivos_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
Style/NumericLiterals:
MinDigits: 9

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SafeForConstants.
Style/RedundantFetchBlock:
Exclude:
- 'config/puma.rb'

# Offense count: 11
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpCharacterClass:
Exclude:
- 'lib/validadores.rb'

# Offense count: 15
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'lib/validadores.rb'

# Offense count: 109
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'config/application.rb'
- 'config/environments/production.rb'
- 'config/puma.rb'
- 'db/schema.rb'
- 'lib/tasks/import.rake'
- 'spec/controllers/calculos_controller_spec.rb'
- 'spec/controllers/clientes_controller_spec.rb'
- 'spec/controllers/resultados_controller_spec.rb'
- 'spec/lib/calculos_spec.rb'
- 'spec/lib/importa_arquivos_spec.rb'
- 'spec/lib/resultados_spec.rb'
- 'spec/lib/validadores_spec.rb'
- 'spec/rails_helper.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: MinSize.
# SupportedStyles: percent, brackets
Style/SymbolArray:
EnforcedStyle: brackets

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 331
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.9
3.1.2
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM --platform=linux/x86_64 ruby:2.6-alpine
FROM --platform=linux/x86_64 ruby:3.1-alpine

LABEL Name=achievemore-ruby Version=2.6
LABEL Name=achievemore-ruby Version=3.1

WORKDIR /app

Expand All @@ -16,9 +16,15 @@ RUN apk --update add less

COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN gem install bundler
RUN gem update --system
RUN bundle install
COPY . /app

# Fix sqlite3_native.so: posix_fallocate64: symbol not found - source: https://gist.github.com/hopsoft/9a0bf00be2816cbe036fae5aa3d85b73
RUN gem uninstall sqlite3 --all
RUN CFLAGS=-DSQLITE_DEFAULT_PAGE_SIZE=16300 gem install sqlite3 --platform=ruby

EXPOSE 3000

# Start the main process.
Expand Down
Loading