Giter VIP home page Giter VIP logo

rubocop-solidus's People

Contributors

abhishekgupta5 avatar danielepalombo avatar massimilianolattanzio avatar mcrisologo avatar piyushswain avatar safafa avatar samuelmartini avatar waiting-for-dev avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rubocop-solidus's Issues

Targeted Solidus Version

Add a feature that allows cops to check and decide whether to execute themselves against a solidus version mentioned in the configuration.

rubocop.yml can hold a solidus version. e.g. - TargetSolidusVersion in the configuration.

AllCops:
TargetSolidusVersion: 2.11

There should a module that holds methods that allow us to

assign a minimum solidus version to a cop

fetch the TargetSolidusVersion from the rubocop.yml file

check a cops minimum version against the targeted version and allow a cop to be skipped.

Note: Check minimum_target_rails_version method on rubocop-rails for an idea on the implementation

Issue will be closed when:

  • User can set a TargetSolidusVersion from rubocop.yml
  • User can set a minimum supported version of solidus for a cop
  • Cop is skipped if target solidus version is lower than minimum supported version of the cop.

button_link_to -> link_to

After upgrading to Solidus 2.6, you may encounter deprecation warnings. One of these could be about the button_link_to deprecated in favor of button_to or link_to (ref). To update all occurrences, you can use this simple regex:

Search for <%= button_link_to (.+) %>.

Replace with <%= link_to $1, class: 'btn btn-primary' %> or <%= button_to $1, class: 'btn btn-primary' %> depending on which one you need.

Minimum solidus version: from the beginning

Depending on #37

Stop calling Spree::Refund#perform! after creating a refund

From Solidus v3.0 onwards, #perform! will need to be explicitly called when creating new refunds. Please, change your code from:

Spree::Refund.create(your: attributes)

to:

Spree::Refund.create(your: attributes, perform_after_creation: false).perform!

The perform_after_creation attribute will be removed in Solidus 3.x.

Stop calling perform! as Spree::Refund after_create callback #3641 (kennyadsl)

Look for:

For solidus 2.11 looks for Spree::Refund.create/new without perform_after_create


For Solidus < 2.11 we can consider patching the model by overriding the method as done here:

solidusio/solidus@3d6f510

solidus_minimum_version: 2.11

default_address -> ship_address

Solidus 3.0 removes the usage of default_address in favor of ship_address in this commit.

Probably, it will be helpful to create a new cop to automatically replace all occurrences with the new value or at least raise a warning.

Different cases:
default_address -> ship_address
default_addresses -> ship_addresses

The new_cop command started to fail after adding the support to Ruby 2.4

The new_cop command is not working anymore because of an issue with the RuboCop::Cop::Generator class in the Rakefile.

After adding the support to Ruby 2.4, we had to downgrade rubocop version. The old version of RuboCop::Cop::Generator class used an additional github_user parameter that is not present in our Rakefile. So when you run the new_cop command results in this error:

ArgumentError: wrong number of arguments (given 1, expected 2)
rubocop-solidus/Rakefile:26:in `new'

After discussing with @abhishekgupta5 and @piyushswain, we thought the best way to solve this issue would be to create a separate branch with support for Ruby 2.4 but remove it from the main branch.

We could fix this issue in particular, but something else could not work properly because we used the latest version of the extension generator, but we are using an old version of rubocop, resulting in classes being misused.

@DanielePalombo, WDYT?

Detect class_eval

Solidus suggests a decorator module instead of class_eval when overriding some features. Check this link for an example.

#2

existing_card_id -> wallet_payment_source_id

Solidus 3.0 removes the usage of existing_card_id in favor of wallet_payment_source_id in this commit.

Probably it will be helpful to create a new cop to automatically replace all occurrences with the new value, or at least raise a warning.

Create Solidus Rubocop presentation

It would be nice to create a Solidus Rubocop presentation.
It should cover the problem and our proposed solution.
What are the benefits of this solution
How to use it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.