Skip to content

Commit

Permalink
Revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav-nain committed Nov 11, 2024
1 parent 116b415 commit 537b1a5
Show file tree
Hide file tree
Showing 54 changed files with 138 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.2
3.3.2
86 changes: 44 additions & 42 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,68 +1,70 @@
PATH
remote: .
specs:
rubocop-bugcrowd (0.1.0)
rubocop
rubocop-bugcrowd (1.0.0)
rubocop (= 1.68.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
byebug (11.1.1)
coderay (1.1.2)
diff-lcs (1.3)
method_source (0.9.2)
parallel (1.23.0)
parser (3.2.2.3)
byebug (11.1.3)
coderay (1.1.3)
diff-lcs (1.5.1)
json (2.8.1)
language_server-protocol (3.17.0.3)
method_source (1.1.0)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.8.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (~> 0.10)
racc (1.7.1)
pry (>= 0.13, < 0.15)
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.1)
regexp_parser (2.8.1)
rexml (3.2.6)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
rake (13.2.1)
regexp_parser (2.9.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rubocop (0.93.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.6.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.34.1)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
unicode-display_width (1.8.0)
unicode-display_width (2.6.0)

PLATFORMS
ruby

DEPENDENCIES
pry-byebug
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 0.93)
pry-byebug (= 3.10.1)
rake
rspec
rubocop (= 1.68.0)
rubocop-bugcrowd!

BUNDLED WITH
2.1.4
2.5.16
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ RSpec::Core::RakeTask.new(:spec)

task default: :spec

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/bugcrowd/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module RuboCop
module Bugcrowd
VERSION = '0.1.0'
VERSION = '1.0.0'
end
end
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/add_index_non_concurrently.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Bugcrowd
#
# # good
# add_index :table_name, :column, zibble: :bibble, algorithm: :concurrently
class AddIndexNonConcurrently < Cop
class AddIndexNonConcurrently < Base
include Database

MSG = 'By default, Postgres locks writes to a table while creating an index on it ' \
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/avoid_sample_in_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Bugcrowd
# expect(thing).to have_some_property
# expect(thing1).to have_some_property
#
class AvoidSampleInSpecs < Cop
class AvoidSampleInSpecs < Base
MSG = 'Avoid using sample in spec as it can cause non-deterministic behavior'

def_node_matcher :sample?, <<~PATTERN
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/can_with_class_const.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class CanWithClassConst < RuboCop::Cop::Cop
class CanWithClassConst < Base
MSG = <<~COPCONTENT
🚨 Don't call can? with a class constant, as it will unexpectedly pass. Use an instance instead. (https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities-with-Blocks#only-for-object-attributes) 🚨
COPCONTENT
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/constant_assignment_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class ConstantAssignmentSpecs < RuboCop::Cop::Cop
class ConstantAssignmentSpecs < Base
MSG = <<~COPCONTENT
🚨 Constants persist across specs due to global nature 🚨
COPCONTENT
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/controller_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class ControllerSpecs < RuboCop::Cop::Cop
class ControllerSpecs < Base
MSG = <<~COPCONTENT
🚨 Controller specs are deprecated, please create request specs instead 🚨
See https://everydayrails.com/2016/08/29/replace-rspec-controller-tests.html for an overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Bugcrowd
# # good
# Command.call(thing: Current.thingo)
#
class CurrentJumpingControllerBoundary < Cop
class CurrentJumpingControllerBoundary < Base
MSG = 'Current should not be used outside of controllers. '\
'Pass it along to other systems that need it'

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/dangerous_env_mutation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Bugcrowd
#
# # good
# allow(Rails.configuration.x).to receive(blah).and_return 'zah'
class DangerousEnvMutation < Cop
class DangerousEnvMutation < Base
MSG = 'Stub ENV or use configuration objects instead of ' \
'directly modifying global ENV state'

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/dangerous_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module RuboCop
module Cop
module Bugcrowd
class DangerousTransaction < Cop
class DangerousTransaction < Base
MSG = "Use ProperTransaction.start instead of ActiveRecord's base, " \
'class, or instance-level transaction methods. See ' \
'https://bugcrowd.atlassian.net/wiki/spaces/DEV/blog/2020/03/24/1126006819/' \
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/deprecate_ams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class DeprecateAms < RuboCop::Cop::Cop
class DeprecateAms < Base
MSG = <<~COPCONTENT
🚨 ActiveModelSerializers are slow, unmaintained, and deprecated in our app. Please use Presenters (app/presenters) instead. 🚨
COPCONTENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Bugcrowd
# add_index :table_name, :column_name, unique: true, algorithm: :concurrently
# end
# end
class DisableDdlOnlyWithNonDdlStatements < Cop
class DisableDdlOnlyWithNonDdlStatements < Base
include Database

MSG = 'Only disable ddl transactions for non-ddl statements'
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/faker_in_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class FakerInSpecs < RuboCop::Cop::Cop
class FakerInSpecs < Base
include Faker

MSG = <<~COPCONTENT
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/faker_without_unique.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class FakerWithoutUnique < RuboCop::Cop::Cop
class FakerWithoutUnique < Base
include Faker

MSG = <<~COPCONTENT
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/flipper_in_app_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class FlipperInAppCode < RuboCop::Cop::Cop
class FlipperInAppCode < Base
MSG = <<~COPCONTENT
Generally we want to avoid setting flippers in code.
Flippers should be temporary and used for strategic rollouts, not persistence -- use real databases instead
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/no_commit_db_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class NoCommitDbTransaction < RuboCop::Cop::Cop
class NoCommitDbTransaction < Base
include Database

MSG = "🚨 🚨 🚨 Don't use 'commit_db_transaction'. See https://bugcrowd.atlassian.net/wiki/spaces/DEV/pages/789708817/Database+Migrations"
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/no_event_deprecated_publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class NoEventDeprecatedPublish < Cop
class NoEventDeprecatedPublish < Base
# The way we publish events, we don't want to publish the event externally if the
# transaction triggering it has been rolled back. We also don't want the event to be
# rolled back in the case that processing the event fails so we do not lose record of
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/no_include_run_in_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Bugcrowd
# end
#

class NoIncludeRunInTransaction < Cop
class NoIncludeRunInTransaction < Base
MSG = 'Prefer explicit transactions over wrapping entire command or organizer ' \
'see: https://bugcrowd.atlassian.net/wiki/spaces/DEV/pages/589856783/How+to+use+activerecord+transactions'

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/no_unrestricted_polymorph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class NoUnrestrictedPolymorph < RuboCop::Cop::Cop
class NoUnrestrictedPolymorph < Base
# Ensures that the `polymorphic_belongs_to` method from SafePolymorphic is used instead
# of the `polymorphic: true` option for `belongs_to`
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class PreferRequestYieldingResponsePattern < Cop
class PreferRequestYieldingResponsePattern < Base
#
# @example
#
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/prefer_sensible_string_enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Bugcrowd
#
# enumerate_strings_for :source, [:web, :csv]
#
class PreferSensibleStringEnum < Cop
class PreferSensibleStringEnum < Base
MSG = 'Prefer SensibleStringEnum over built in Rails enum.'

def_node_matcher :enum?, <<~PATTERN
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/prefer_text_to_string_column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class PreferTextToStringColumn < RuboCop::Cop::Cop
class PreferTextToStringColumn < Base
include Database

MSG = 'Prefer text column to string, e.g. add_column :table, :column, :text. ' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class PreventReindexFullESDocumentCop < Cop
class PreventReindexFullESDocumentCop < Base
#
# @example
#
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/rails_configuration_mutation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module RuboCop
module Cop
module Bugcrowd
class RailsConfigurationMutation < Cop
class RailsConfigurationMutation < Base
# TODO: Implement the cop in here.
#
# In many cases, you can use a node matcher for matching node pattern.
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/replica_identity_required.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class ReplicaIdentityRequired < RuboCop::Cop::Cop
class ReplicaIdentityRequired < Base
# Checks that tables have a replica identity defined
#
# @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class RequireOptionalForBelongsTo < RuboCop::Cop::Cop
class RequireOptionalForBelongsTo < Base
# Ensures that the :optional argument is supplied to the belongs_to method
# to help with upgrading to the new rails default
#
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/sidekiq_testing_inline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class SidekiqTestingInline < Cop
class SidekiqTestingInline < Base
# Sidekiq::Testing.inline! can cause huge cascade of handlers to be called.
# When you use inline! Valis workers are triggered without you realizing,
# which create indexes that are not cleaned up by subsequent specs.
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/sleepy_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Bugcrowd
# - instead of waiting for the page to be updated you can check
# that the correct behavior is called
# (this can sometimes make the test less robust)
class SleepySpecs < RuboCop::Cop::Cop
class SleepySpecs < Base
MSG = <<~COPCONTENT
🚨 Do not use sleep, use wait instead 🚨
Sleep will wait for the given amount of time whether or not it needs to,
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/travel_to_block_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class TravelToBlockForm < RuboCop::Cop::Cop
class TravelToBlockForm < Base
MSG = <<~COPCONTENT
🚨 Prefer travel_to in its block form 🚨
COPCONTENT
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/uuid_primary_key_required.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
module Cop
module Bugcrowd
class UuidPrimaryKeyRequired < RuboCop::Cop::Cop
class UuidPrimaryKeyRequired < Base
include Database

# Checks that tables are created with uuid primary keys
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/bugcrowd/visit_in_spec_before_hook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module RuboCop
module Cop
module Bugcrowd
class VisitInSpecBeforeHook < Cop
class VisitInSpecBeforeHook < Base
MSG = "Avoid calling 'visit' in before hooks. See https://gist.github.com/maschwenk/6eaf0a3cbf0e6f1432b923cbca7e34d1"

def_node_matcher :begin_before_block?, <<~PATTERN
Expand Down
Loading

0 comments on commit 537b1a5

Please sign in to comment.