Skip to content

Instantly share code, notes, and snippets.

class Dirty
# This method smells of :reek:NestedIterators but ignores them
def awful(x, y, offset = 0, log = false)
puts @screen.title
@screen = widgets.map { |w| w.each { |key| key += 3 * x } }
puts @screen.contents
puts @screen.contents
puts @screen.contents
puts @screen.contents
puts @screen.contents
require 'json'
input_file = 'eslint_result.json'
output_file = 'eslint_todo.json'
array = JSON.parse open(input_file, &:read)
rules_counts = {}
array.each do |file|
next if file['errorCount'] == 0 && file['warningCount'] == 0
file['messages'].each do |message|
@sumyapp
sumyapp / eslint_warn_count.rb
Last active October 20, 2016 01:52
ESLintの出力JSONファイルを読み込み、指摘が1件以上あるルールを発見し、設定ファイルとして出力する。指摘件数はJSONコメントで記載される
require 'json'
input_file = 'eslint_result.json'
output_file = 'eslint_todo.json'
array = JSON.parse open(input_file, &:read)
rules_counts = {}
array.each do |file|
next if file['errorCount'] == 0 && file['warningCount'] == 0
file['messages'].each do |message|
@sumyapp
sumyapp / goodcheck.yml
Created March 16, 2018 02:45
Goodcheck Config exmaple for PHP
rules:
- id: com.example.mysql
pattern: mysql_*
message: |
Do not use mysql_* functions.
Please use PDO or Framework's ORM.
MySQL Functions (PDO_MYSQL)
http://php.net/manual/en/ref.pdo-mysql.php
glob:
- "**/*.php"
@sumyapp
sumyapp / goodcheck.yml
Created April 25, 2018 08:12
goodcheck.yml for PHP. Reference php.net version
rules:
#====================================================================
# PHP コア
# INI ディレクティブ
#--------------------------------------------------------------------
# 言語オプション
- id: com.sideci.php.core.ini.asp_tags
pattern:
regexp: '([''"])asp_tags\1'
glob: "**/*.php"
/**
* The MIT License
* Copyright (c) 2014-2016 Ilkka Seppälä
*
* 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:
@sumyapp
sumyapp / goodcheck.yml
Last active February 12, 2019 03:02
goodcheck.yml sample for java project
rules:
- id: com.companyname.java.instanceof
pattern: instanceof
message: instanseofを使わなくて済むように設計しましょう。instanceofについての詳細は https://www.slideshare.net/HiroshiSaito1/deep-dive-into-instanceof を見てください
glob:
- "**/*.java"
fail:
- if("Hello, world!" instanceof String){}
pass:
- if("Hello, world".getClass().getCanonicalName() == "java.lang.String"){}
@sumyapp
sumyapp / goodcheck.yml
Created February 4, 2019 02:42
Goodcheck YAML sample for target-blank
rules:
- id: review.sider.html.target-blank
pattern:
- 'target="_blank"'
- "target='_blank'"
- 'target: "_blank"'
- "target: '_blank'"
glob:
- "**/*.{slim,erb,html,jsx,tsx}"
message: |
@sumyapp
sumyapp / goodcheck.yml
Last active February 15, 2019 04:18
Goodcheck sample for Swift
rules:
- id: deprecated
pattern:
token: "@available("
case_sensitive: false
message: The method is deprecated. Could you use new version?
glob:
- "**/*.h"
- "**/*.m"
- "**/*.swift"
@sumyapp
sumyapp / goodcheck.yml
Last active March 5, 2019 08:41
Java Goodcheck sample 2019-03-01
rules:
# Base(パターンマッチさせやすくする為のルールです)
- id: com.example.base.1
pattern:
regexp: (\S==\S|\S=\S)
message:
==や=の前後には半角空白を入れてください。
glob:
- "**/*.java"
fail: