Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 18 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ Lint/EmptyFile:
Exclude:
- 'packages/forest_admin_rails/app/models/forest_admin_rails/application_record.rb'

Lint/InterpolationCheck:
Exclude:
- 'packages/forest_admin_agent/spec/lib/forest_admin_agent/http/error_translator_spec.rb'
- 'packages/forest_admin_rails/lib/generators/forest_admin_rails/install_generator.rb'

Naming/MethodName:
Exclude:
- 'packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/utils/collection_spec.rb'

Style/OneClassPerFile:
Exclude:
- 'packages/forest_admin_rails/lib/forest_admin_rails/engine.rb'

Style/SelectByKind:
Exclude:
- 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/frontend_validation_utils.rb'
- 'packages/forest_admin_datasource_customizer/lib/forest_admin_datasource_customizer/decorators/empty/empty_collection_decorator.rb'

Metrics/AbcSize:
Enabled: false

Expand Down Expand Up @@ -428,10 +446,6 @@ Style/PercentLiteralDelimiters:
Exclude:
- 'packages/forest_admin_rails/lib/generators/forest_admin_rails/install_generator.rb'

Lint/InterpolationCheck:
Exclude:
- 'packages/forest_admin_rails/lib/generators/forest_admin_rails/install_generator.rb'

Lint/UnusedMethodArgument:
Exclude:
- 'packages/forest_admin_rails/config/initializers/forest_admin_error_subscriber.rb'
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ gemspec
group :development, :tests do
gem "overcommit", "~> 0.60"
gem "rspec", "~> 3.0"
gem "rubocop", "1.77"
gem "rubocop-performance", "1.25.0"
gem "rubocop-rspec", "3.5.0"
gem "rubocop", "1.86.1"
gem "rubocop-performance", "1.26.1"
gem "rubocop-rspec", "3.9.0"
gem 'simplecov', "~> 0.22", require: false
gem 'simplecov_json_formatter', "~> 0.1.4"
end
3 changes: 3 additions & 0 deletions packages/forest_admin_agent/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ group :development, :test do
gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit'
gem 'forest_admin_test_toolkit', path: '../forest_admin_test_toolkit'
gem 'rspec', '~> 3.0'
gem 'rubocop', '1.86.1'
gem 'rubocop-performance', '1.26.1'
gem 'rubocop-rspec', '3.9.0'
gem 'simplecov', '~> 0.22', require: false
gem 'simplecov-html', '~> 0.12.3'
gem 'simplecov_json_formatter', '~> 0.1.4'
Expand Down
3 changes: 3 additions & 0 deletions packages/forest_admin_agent/Gemfile-test
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ group :development, :test do
gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit'
gem 'forest_admin_test_toolkit', path: '../forest_admin_test_toolkit'
gem 'rspec', '~> 3.0'
gem 'rubocop', '1.86.1'
gem 'rubocop-performance', '1.26.1'
gem 'rubocop-rspec', '3.9.0'
gem 'simplecov', '~> 0.22', require: false
gem 'simplecov-html', '~> 0.12.3'
gem 'simplecov_json_formatter', '~> 0.1.4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CountRelated < AbstractRelatedRoute
include ForestAdminAgent::Builder
include ForestAdminDatasourceToolkit::Utils
include ForestAdminDatasourceToolkit::Components::Query

def setup_routes
add_route(
'forest_related_count',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DissociateRelated < AbstractRelatedRoute
include ForestAdminAgent::Builder
include ForestAdminDatasourceToolkit::Utils
include ForestAdminDatasourceToolkit::Components::Query

def setup_routes
add_route(
'forest_related_dissociate',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Show < AbstractAuthenticatedRoute
include ForestAdminAgent::Builder
include ForestAdminAgent::Utils
include ForestAdminDatasourceToolkit::Components::Query

def setup_routes
add_route('forest_show', 'get', '/:collection_name/:id', ->(args) { handle_request(args) })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Resources
class Store < AbstractAuthenticatedRoute
include ForestAdminAgent::Builder
include ForestAdminDatasourceToolkit::Components::Query

def setup_routes
add_route('forest_store', 'post', '/:collection_name', ->(args) { handle_request(args) })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Security
class ScopeInvalidation < AbstractRoute
include ForestAdminAgent::Builder
include ForestAdminAgent::Services

def setup_routes
add_route(
'forest_scope_invalidation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Routes
module System
class HealthCheck < AbstractRoute
include ForestAdminAgent::Builder

def setup_routes
add_route('forest', 'GET', '/', ->(args) { handle_request(args) })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module ForestAdminAgent
module Auth
module OAuth2
include ForestAdminAgent::Utils

describe ForestProvider do
let(:rendering_id) { 10 }
let(:attributes) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Capabilities
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Schema::Relations

describe Collections do
include_context 'with caller'
subject(:capabilities_collections) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Resources
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree::Nodes

describe Count do
include_context 'with caller'
subject(:count) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Resources
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
include ForestAdminDatasourceToolkit::Schema

describe Csv do
include_context 'with caller'
subject(:csv) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Resources
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
include ForestAdminDatasourceToolkit::Schema

describe Delete do
include_context 'with caller'
subject(:delete) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Related
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe AssociateRelated do
include_context 'with caller'
subject(:associate) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Related
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe CountRelated do
include_context 'with caller'
subject(:count) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Related
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe CsvRelated do
include_context 'with caller'
subject(:csv) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Related
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe DissociateRelated do
include_context 'with caller'
subject(:dissociate) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Related
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe ListRelated do
include_context 'with caller'
subject(:list) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Related
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe UpdateRelated do
include_context 'with caller'
subject(:update) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Resources
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

describe Show do
include_context 'with caller'
subject(:show) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Resources
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
include ForestAdminDatasourceToolkit::Schema

describe Store do
include_context 'with caller'
subject(:store) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Resources
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
include ForestAdminDatasourceToolkit::Schema

describe Update do
include_context 'with caller'
subject(:update) { described_class.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module ForestAdminAgent
module Utils
include ForestAdminDatasourceToolkit::Components::Query

describe CsvGenerator do
let(:projection) { Projection.new(%w[id last_name first_name email active created_at updated_at address:planet]) }
let(:records) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module ForestAdminAgent
module Utils
include ForestAdminDatasourceToolkit::Components::Query

describe CsvGeneratorStream do
let(:projection) { Projection.new(%w[id first_name last_name]) }
let(:filter) { Filter.new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ module Utils
parent_association_name: nil,
all_records: true,
all_records_subset_query: [
'fields[Car]' => 'id,first_name,last_name',
'page[number]' => 1,
'page[size]' => 15
{
'fields[Car]' => 'id,first_name,last_name',
'page[number]' => 1,
'page[size]' => 15
}
],
all_records_ids_excluded: ['4'],
smart_action_id: nil
Expand All @@ -122,9 +124,11 @@ module Utils
parent_association_name: nil,
all_records: false,
all_records_subset_query: [
'fields[Car]' => 'id,first_name,last_name',
'page[number]' => 1,
'page[size]' => 15
{
'fields[Car]' => 'id,first_name,last_name',
'page[number]' => 1,
'page[size]' => 15
}
],
all_records_ids_excluded: ['4'],
smart_action_id: nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module ForestAdminAgent
module Utils
include ForestAdminDatasourceToolkit::Exceptions

describe QueryValidator do
describe 'valid queries' do
it 'allows a simple SELECT query' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Utils
module Schema
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema

describe GeneratorCollection do
before do
@datasource = Datasource.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Utils
module Schema
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema

describe GeneratorField do
context 'when field is OneToMany relation' do
before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Utils
module Schema
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema

describe GeneratorField do
context 'when field is OneToMany relation' do
before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Utils
module Schema
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema

describe GeneratorField do
context 'when field is OneToOne relation' do
before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Utils
module Schema
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Schema

describe GeneratorField do
context 'when field is polymorphic relation' do
before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Schema
include ForestAdminDatasourceToolkit
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
include ForestAdminDatasourceToolkit::Schema

describe GeneratorField do
before do
@datasource = Datasource.new
Expand Down
4 changes: 3 additions & 1 deletion packages/forest_admin_datasource_active_record/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ gem 'forest_admin_agent', path: '../forest_admin_agent'
gem 'forest_admin_datasource_customizer', path: '../forest_admin_datasource_customizer'
gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.21'
gem 'rubocop', '1.86.1'
gem 'rubocop-performance', '1.26.1'
gem 'rubocop-rspec', '3.9.0'

group :development, :test do
gem 'rails'
Expand Down
4 changes: 3 additions & 1 deletion packages/forest_admin_datasource_active_record/Gemfile-test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ source "https://rubygems.org"
gemspec

gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.21'
gem 'rubocop', '1.86.1'
gem 'rubocop-performance', '1.26.1'
gem 'rubocop-rspec', '3.9.0'

group :development, :test do
gem 'database_cleaner-active_record'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module ForestAdminDatasourceActiveRecord
module Parser
module Validation
include ForestAdminDatasourceToolkit::Components::Query::ConditionTree

def get_validations(column)
validations = []
# NOTICE: Do not consider validations if a before_validation Active Records
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def compute_result_aggregate(rows)
rows.map do |row|
{
'value' => row.send(@operation.to_sym),
'group' => @aggregation.groups.each_with_object({}) do |group, memo|
memo[group[:field]] = row.send(group[:field].to_sym)
'group' => @aggregation.groups.to_h do |group|
[group[:field], row.send(group[:field].to_sym)]
end
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module ForestAdminDatasourceActiveRecord
include ForestAdminDatasourceToolkit::Schema

describe Collection do
context 'without polymorphic support' do
let(:datasource) { Datasource.new({ adapter: 'sqlite3', database: 'db/database.db' }) }
Expand Down
4 changes: 3 additions & 1 deletion packages/forest_admin_datasource_customizer/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ gemspec
gem 'forest_admin_agent', path: '../forest_admin_agent'
gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.21'
gem 'rubocop', '1.86.1'
gem 'rubocop-performance', '1.26.1'
gem 'rubocop-rspec', '3.9.0'

group :development, :test do
gem 'forest_admin_test_toolkit', path: '../forest_admin_test_toolkit'
Expand Down
Loading
Loading