Skip to content

Commit

Permalink
🎉 Initialize gem structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafayet-monon committed Oct 12, 2020
0 parents commit 993ec79
Show file tree
Hide file tree
Showing 17 changed files with 489 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "Bug Report"
about: "You found something that is not working. Report it so that it can be fixed. 👷‍"
title: "Fix: "
labels: "type : bug"
---

## Issue

Describe the issue you are facing. Show us the implementation: screenshots, gif, etc.

## Expected

Describe what should be the correct behaviour.

## Steps to reproduce

1.
2.
3.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: "Feature"
about: "Open a feature issue to add new functionalities."
title: "Add "
labels: "type : feature"
---

## Why

Describe the big picture of the feature and why it's needed.

## Who Benefits?

Describe who will be the beneficiaries e.g. everyone, specific chapters, clients...
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
https://github.com/nimblehq/git-template/issues/??

## What happened 👀

Describe the big picture of your changes here to communicate to the team why we should accept this pull request.

## Insight 📝

Describe in details how to test the changes, which solution you tried but did not go with, referenced documentation is welcome as well.

## Proof Of Work 📹

Show us the implementation: screenshots, gif, etc.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
pkg
.idea/
.yardoc
.rakeTasks
151 changes: 151 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml

# If you don't like these settings, just delete this file :)

AllCops:
TargetRubyVersion: 2.0

Style/StringLiterals:
EnforcedStyle: double_quotes
Enabled: true

# kind_of? is a good way to check a type
Style/ClassCheck:
EnforcedStyle: kind_of?

# It's better to be more explicit about the type
Style/BracesAroundHashParameters:
Enabled: false

# specs sometimes have useless assignments, which is fine
Lint/UselessAssignment:
Exclude:
- '**/spec/**/*'

# We could potentially enable the 2 below:
Layout/IndentHash:
Enabled: false

Layout/AlignHash:
Enabled: false

# HoundCI doesn't like this rule
Layout/DotPosition:
Enabled: false

# We allow !! as it's an easy way to convert ot boolean
Style/DoubleNegation:
Enabled: false

# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false

# We want to allow class Fastlane::Class
Style/ClassAndModuleChildren:
Enabled: false

Metrics/AbcSize:
Max: 60

# The %w might be confusing for new users
Style/WordArray:
MinSize: 19

# raise and fail are both okay
Style/SignalException:
Enabled: false

# Better too much 'return' than one missing
Style/RedundantReturn:
Enabled: false

# Having if in the same line might not always be good
Style/IfUnlessModifier:
Enabled: false

# and and or is okay
Style/AndOr:
Enabled: false

# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 350

Metrics/CyclomaticComplexity:
Max: 17

# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 370

# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 10

Metrics/PerceivedComplexity:
Max: 18

# Sometimes it's easier to read without guards
Style/GuardClause:
Enabled: false

# something = if something_else
# that's confusing
Style/ConditionalAssignment:
Enabled: false

# Better to have too much self than missing a self
Style/RedundantSelf:
Enabled: false

Metrics/MethodLength:
Max: 60

# We're not there yet
Style/Documentation:
Enabled: false

# Adds complexity
Style/IfInsideElse:
Enabled: false

# danger specific

Style/BlockComments:
Enabled: false

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Metrics/BlockLength:
Max: 345
Exclude:
- "**/*_spec.rb"

Style/MixinGrouping:
Enabled: false

Style/FileName:
Enabled: false

Layout/IndentHeredoc:
Enabled: false

Style/SpecialGlobalVars:
Enabled: false

PercentLiteralDelimiters:
PreferredDelimiters:
"%": ()
"%i": ()
"%q": ()
"%Q": ()
"%r": "{}"
"%s": ()
"%w": ()
"%W": ()
"%x": ()

Security/YAMLLoad:
Enabled: false
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in danger-undercover.gemspec
gemspec
19 changes: 19 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# A guardfile for making Danger Plugins
# For more info see https://github.com/guard/guard#readme

# To run, use `bundle exec guard`.

guard :rspec, cmd: 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
watch(rspec.spec_support) { rspec.spec_dir }
watch(rspec.spec_files)

# Ruby files
ruby = dsl.ruby
dsl.watch_spec_files_for(ruby.lib_files)
end
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2020 rafayet-monon <rafayet.monon@gmail.com>

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# danger-undercover

A Danger plugin to use with Undercover gem.

## Installation

$ gem install danger-undercover

## Usage

Methods and attributes from this plugin are available in
your `Dangerfile` under the `undercover` namespace.

## Development

1. Clone this repo
2. Run `bundle install` to setup dependencies.
3. Run `bundle exec rake spec` to run the tests.
4. Use `bundle exec guard` to automatically have tests run as you make changes.
5. Make your changes.
23 changes: 23 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:specs)

task default: :specs

task :spec do
Rake::Task['specs'].invoke
Rake::Task['rubocop'].invoke
Rake::Task['spec_docs'].invoke
end

desc 'Run RuboCop on the lib/specs directory'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
end

desc 'Ensure that the plugin passes `danger plugins lint`'
task :spec_docs do
sh 'bundle exec danger plugins lint'
end
49 changes: 49 additions & 0 deletions danger-undercover.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'undercover/gem_version.rb'

Gem::Specification.new do |spec|
spec.name = 'danger-undercover'
spec.version = Undercover::VERSION
spec.authors = ['rafayet-monon']
spec.email = ['rafayet.monon@gmail.com']
spec.description = %q{Show undercover report to PRs}
spec.summary = %q{A Danger plugin for Undercover gem}
spec.homepage = 'https://github.com/nimblehq/danger-undercover'
spec.license = 'MIT'

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'

# General ruby development
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake', '~> 10.0'

# Testing support
spec.add_development_dependency 'rspec', '~> 3.4'

# Linting code and docs
spec.add_development_dependency "rubocop"
spec.add_development_dependency "yard"

# Makes testing easy via `bundle exec guard`
spec.add_development_dependency 'guard', '~> 2.14'
spec.add_development_dependency 'guard-rspec', '~> 4.7'

# If you want to work on older builds of ruby
spec.add_development_dependency 'listen', '3.0.7'

# This gives you the chance to run a REPL inside your tests
# via:
#
# require 'pry'
# binding.pry
#
# This will stop test execution and let you inspect the results
spec.add_development_dependency 'pry'
end
1 change: 1 addition & 0 deletions lib/danger_plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require "undercover/plugin"
1 change: 1 addition & 0 deletions lib/danger_undercover.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require "undercover/gem_version"
3 changes: 3 additions & 0 deletions lib/undercover/gem_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Undercover
VERSION = "0.0.1".freeze
end
33 changes: 33 additions & 0 deletions lib/undercover/plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module Danger
# This is your plugin class. Any attributes or methods you expose here will
# be available from within your Dangerfile.
#
# To be published on the Danger plugins site, you will need to have
# the public interface documented. Danger uses [YARD](http://yardoc.org/)
# for generating documentation from your plugin source, and you can verify
# by running `danger plugins lint` or `bundle exec rake spec`.
#
# You should replace these comments with a public description of your library.
#
# @example Ensure people are well warned about merging on Mondays
#
# my_plugin.warn_on_mondays
#
# @see rafayet-monon/danger-undercover
# @tags monday, weekends, time, rattata
#
class DangerUndercover < Plugin

# An attribute that you can read/write from your Dangerfile
#
# @return [Array<String>]
attr_accessor :my_attribute

# A method that you can call from your Dangerfile
# @return [Array<String>]
#
def warn_on_mondays
warn 'Trying to merge code on a Monday' if Date.today.wday == 1
end
end
end
Loading

0 comments on commit 993ec79

Please sign in to comment.