Coder Social home page Coder Social logo

dlss_cops's Introduction

DEPRECATED

This gem was deprecated on March 4th, 2022 after lying fallow for four years.

DlssCops

DlssCops is a Rubocop configuration gem that holds DLSS's baseline Ruby style guide. See https://github.com/sul-dlss/DeveloperPlaybook/tree/master/style for more information about the DLSS style. See https://github.com/bbatsov/rubocop for more information about Rubocop.

Installation

We recommend you use the latest version of DlssCops but if needed, you can select a specific version to manage change.

Add a development_dependency in your gem's gemspec file

  gemspec.add_development_dependency 'dlss_cops'

OR, if it's not a gem, add these lines to your Gemfile:

group :development, :test do
  gem 'dlss_cops'
end

Usage

Set up your .rubocop.yml file:

inherit_gem:
  dlss_cops: "config/dlss_baseline.yml"

AllCops:
  TargetRubyVersion: 2.2

Then you can launch rubocop via: bundle exec rubocop <options>

See https://github.com/bbatsov/rubocop#basic-usage for more information.

dlss_cops's People

Contributors

mjgiarlo avatar ndushay avatar dazza-codes avatar atz avatar cbeer avatar mejackreed avatar

Watchers

Jeremy Nelson avatar Justin Coyne avatar Jessie Keck avatar Tony Zanella avatar  avatar  avatar Cory Lown avatar Justin Littman avatar Kam Chan avatar Benjamin Albritton avatar James Cloos avatar Marlo Longley avatar Laura Wrubel avatar Jon Robertson avatar  avatar Aaron Collier avatar Joshua Greben avatar  avatar  avatar  avatar  avatar Darsi Rueda avatar  avatar  avatar

Forkers

dpn-admin

dlss_cops's Issues

Create a corresponding .editorconfig for ruby code style

The purpose of this issue is to identify a way that we can auto-format code in our IDEs so that it's consistent with rubocop style checks. The question is, how do we translate the rubop style settings from the dlss_baseline.yml into an .editorconfig file?

Rubocop is a style checker that enforces style after the fact. It does not facilitate the creation or autoformatting of consistent code in an IDE. There are some rubocop plugins that enable warnings in IDEs that code is inconsistent with rubocop, but they have to constantly run rubocop in the background to check code (performance hit). Some IDEs do not provide enough configuration options to support developing code in a style that is consistent with rubocop settings. This is where http://editorconfig.org/ comes in. It can help to configure an IDE in a way that auto-formats code in a consistent way, across IDEs.

Initial suggestion from slack...

@mjgiarlo - investigating a possible connection, if any, between rubocop ruby style stuff and http://editorconfig.org/

Curious to see if there is a way to create an .editorconfig that is consistent with https://github.com/sul-dlss/dlss_cops - would be great if rubocop can auto-gen an .editorconfig file, but manual creation might not be too tedious.

rubocop update brakes stuff

# Updated dlss_cops and rubocop on the sul_pub project and get the following:
$ bundle exec rubocop
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/IndentationConsistency has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/AccessModifierIndentation has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/AlignHash has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/AlignParameters has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/EmptyLinesAroundClassBody has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/EmptyLinesAroundModuleBody has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/LeadingCommentSpace has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/SpaceAfterNot has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/SpaceAroundEqualsInParameterDefault has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/SpaceInsideBrackets has the wrong namespace - should be Layout
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/dlss_cops-0.0.4/config/dlss_baseline.yml: Style/TrailingBlankLines has the wrong namespace - should be Layout

Update rubocop to be able to upgrade to rake 12.x

We cannot upgrade to rake because dlss_cops has rubocop pinned to an old version that uses deprecated/removed methods in a rake task.

Rake 12.x removed the last_comment method, see

$ bundle exec rake rubocop
rake aborted!
NoMethodError: undefined method `last_comment' for #<Rake::Application:0x00561039bd7d20>
/data/src/dlss/cap/sul_pub/Rakefile:27:in `new'
/data/src/dlss/cap/sul_pub/Rakefile:27:in `block in <top (required)>'
/data/src/dlss/cap/sul_pub/.bundle/bin/bundle:104:in `load'
/data/src/dlss/cap/sul_pub/.bundle/bin/bundle:104:in `<main>'
Tasks: TOP => rubocop
(See full trace by running task with --trace)

Connected to sul-dlss/sul_pub#416

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.