<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Atsushi Nakatsugawa on Medium]]></title>
        <description><![CDATA[Stories by Atsushi Nakatsugawa on Medium]]></description>
        <link>https://medium.com/@moongift?source=rss-9cad8a2aea40------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*a-n1BtN756egNyAR.</url>
            <title>Stories by Atsushi Nakatsugawa on Medium</title>
            <link>https://medium.com/@moongift?source=rss-9cad8a2aea40------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:03:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@moongift/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Let’s use go vet, the standard tool for analyzing Go’s source code]]></title>
            <link>https://medium.com/@moongift/lets-use-go-vet-the-standard-tool-for-analyzing-go-s-source-code-59435ea71059?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/59435ea71059</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[gometalinter]]></category>
            <category><![CDATA[go-vet]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Tue, 08 Aug 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-08-08T18:01:01.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2aokHAxgso8wGiSlU5zLw.jpeg" /></figure><p>Usage of Go is increasing within the company. Due to it being a compiler as well as a static type language, one of its key features is fast execution speed. Besides that, it is easy to learn due to its simple setup, easy enough that programs written using it can be run on multiple platforms.</p><p>With its increasing popularity, we foresee that more teams will begin to use Go. While preserving the quality of the code, in order to improve on serviceability, let’s use software to check the code… there are a few different types of software to choose from, but this time, we’d like to introduce go vet, software that is standardized for and built into Go.</p><h4>how to use go vet</h4><p>go vet is run by using the specification method go tool vet [directory].</p><pre>$ go tool vet path/to/go/project</pre><p>After executing, areas with problems will be indicated in the output.</p><pre>$ go tool vet ./alecthomas/gometalinter/<br>adjcmartix.go:85: suspect or: char != &quot;&quot; || char != &quot; &quot;<br>main.go:55: arg usage in Fprint call is a function value, not a function call<br>resolve.go:161: unreachable code<br>sparse.go:58: _m might be too small for shift of 32</pre><p>After that, just make the necessary edits to the source code according to the identified points.</p><h4>Help</h4><p>go vet’s help can be output using go doc cmd/vet.</p><pre>$ go doc cmd/vet<br>Vet examines Go source code and reports suspicious constructs, such as<br>Printf calls whose arguments do not align with the format string. Vet uses<br>heuristics that do not guarantee all reports are genuine problems, but it<br>can find errors not caught by the compilers.<br><br>It can be invoked three ways:<br><br>By package, from the go tool:<br><br>    go vet package/path/name<br><br>vets the package whose path is provided.<br><br>By files:<br><br>    go tool vet source/directory/*.go<br>  :</pre><h4>Regarding options</h4><p>Items for analysis can be designated in the options. By default, -all is selected, which will conduct a check on all items. For example, to search for unreachable code, use -unreachable.</p><pre>$ go tool vet -unreachable ./alecthomas/<br>alecthomas/gometalinter/_linters/src/golang.org/x/text/unicode/cldr/resolve.go:161: unreachable code<br>alecthomas/gometalinter/vendor/gopkg.in/yaml.v2/decode.go:123: unreachable code</pre><p>Besides that, to change pointers to a numerical value, if you use unsafe.Pointer there is an option to show a warning -unsafeptr.</p><pre>$ go tool vet -unsafeptr ./alecthomas/<br>alecthomas/gometalinter/_linters/src/golang.org/x/tools/go/ssa/interp/external.go:302: possible misuse of unsafe.Pointer<br><br>// the code will be as follows:<br>if pc != 0 {<br>  fn = (*ssa.Function)(unsafe.Pointer(pc)) // indeed unsafe!<br>}</pre><p>Although it’s basically alright to check all the items, please try to assign flags depending on requirements, and just execute the type of item/analysis that is required.</p><p>go vet is standardized, and will identify troublesome points based on previous experience. In short, the identified item is not always the problem. Nonetheless, it may also identify problems that did not show up in the compiler. By making edits alongside the contents, you should be able to write code that is easy to understand.</p><p>Many code analyzing tools for the Go language cause a heavy load on CPU resources. As such, it will take time when run on a local PC, and you might find it frustrating. When that happens, in coordination with Pull Request on GitHub, execute a Go language analytical tool, SideCI, a CI service for automating code reviewing, should be of help. SideCI is compatible with go vet. <a href="https://sideci.com/">A free trial is available, so please try it first</a>。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59435ea71059" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s use bundler’s outdated command to check old Gemfile libraries]]></title>
            <link>https://medium.com/@moongift/lets-use-bundler-s-outdated-command-to-check-old-gemfile-libraries-76e0fd72ac6a?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/76e0fd72ac6a</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[bundler-outdated]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Tue, 25 Jul 2017 18:01:03 GMT</pubDate>
            <atom:updated>2017-07-25T18:01:03.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAjSVn421iWq6OVaBdaANA.jpeg" /></figure><p>In Ruby projects, it is standard to use Bundler to manage dependent libraries. Installing the library is easy, but if you don’t keep installing the latest version, security risks can arise, and the difference between your version and the update can sometimes get so large that even if you want to update, it becomes difficult.</p><p>It is possible to update by running bundle update, but there are of course cases where it performs differently to expectations, so testing is essential. For that reason, let&#39;s use the bundler outdated command to easily test whether there are any gems that actually need updating.</p><h4>How to use bundler outdated</h4><p>Bundler’s outdated feature was implemented in bundler 1.1 (2012), so you should be able to use it easily in nearly all projects that use bundler.</p><p>To use it, just run bundle outdated under any Ruby project (in directories containing a Gemfile). When you do, a list of libraries that have newer versions will appear.</p><p>By looking through the differences for each gem individually, you can update your gems safely. You can update them one at a time, or if that’s too time consuming you can just run bundle update and confirm its behavior by testing.</p><h4>bundler outdated options</h4><p>There are many options. For example, if you attach --minor then only gems with a new minor version will show up. Similarly, --major and --patch also exist. If you update too much at once then the behavior may change, so you can use it to find whether the major version you&#39;re using has a minor update. These options also exist in bundle update.</p><p>Use --local when not checking remote sources. Conversely, if you want to also check pre-releases, use --pre.</p><p>To designate groups such as development, use --group or --groups. You can use this to check only the libraries managed by a specific group.</p><p>If the library version is outdated, sometimes some functions of new documents are unusable, and security risks can arise. At the same time, it’s still scary to just update everything unconditionally. Let’s start by using bundler’s outdated command to check for new versions. Unlike with the update command, they won’t actually be installed, so the run time is shorter as well.</p><p>There is a SaaS service called <a href="https://gemnasium.com/">Gemnasium</a> that makes it easy to see updates for gems. Maybe you could try out a new method you haven’t tried before.</p><p>There are many more convenient SaaS that can improve engineers’ development efficiency. For a code review automation service, there’s SideCl.</p><p><a href="https://sideci.com/">SideCl</a> has a free 2 week trial period. Why not go try it out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76e0fd72ac6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Especially recommend rails_best_practices that teaches you to write code using the Rails Way for…]]></title>
            <link>https://medium.com/@moongift/especially-recommend-rails-best-practices-that-teaches-you-to-write-code-using-the-rails-way-for-50fc93384cbd?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/50fc93384cbd</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[rails-best-practices]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-07-20T18:01:01.395Z</atom:updated>
            <content:encoded><![CDATA[<h3>Especially recommend rails_best_practices that teaches you to write code using the Rails Way for those who have just begun writing in Rails</h3><p>When developing systems that use Ruby on Rails, carrying out that development in accordance with a method called the Rails Way enables the maintenance of a high level of productivity. In other words, it’s important to properly familarize yourself with this method and to develop in accordance with it.</p><p>rails_best_practice is a tool for checking best practice associated with this method. By using tools that analyze the code’s static responses to identify solutions, rather than simply reading some text, you will develop a clear understanding of where you have gone wrong and how to code correctly.</p><h4>Installing rails_best_practices</h4><p>You can use Rubygems to install rails_best_practices.</p><pre>$ gem install rails_best_practices</pre><p>Or, you can also install it by adding a descriptor to the Gemfile in your Rails project.</p><h4>How to use rails_best_practices</h4><p>Once you have installed rails_best_practices, you will be able to use the command rails_best_practices. Executing it is as simple as transferring the relevant path.</p><pre>$ rails_best_practices .<br>Source Code: |====================================================================================================|<br>/path/to/rails/project/db/schema.rb:16 - always add db index (bots =&gt; [user_id])<br>/path/to/rails/project/db/schema.rb:80 - always add db index (temporary_tokens =&gt; [bot_id])<br>/path/to/rails/project/app/controllers/bots_controller.rb:18 - move model logic into model (Resque use_count &gt; 4)<br>/path/to/rails/project/app/helpers/user_sessions_helper.rb:1 - remove empty helpers<br>/path/to/rails/project/app/helpers/application_helper.rb:2 - remove unused methods (ApplicationHelper#get_bot_site)<br>/path/to/rails/project/app/models/chat_log.rb:19 - remove unused methods (ChatLog#slack_demo)</pre><p>From then on, it’s just a matter of modifying the code in accordance with the indications. In the above example, the tool has indicated that the user has forgotten to index a database; that in Rails you write logic in the Model rather than the Controller; and that the user should delete the methods and helper files that they are not using.</p><p>The default is a standard output file, but when the output is in a different format, you can use -f (format specification) and --output-file (output file name).</p><pre>$ rails_best_practices -f html --output-file result.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnSj6FpEifk8wB0lAZtJHA.png" /></figure><p>It’s also possible to output commit IDs and coder names in coordination with Git and Hg. This should make things a lot clearer.</p><pre>$ rails_best_practices --with-git -f html --output-file result.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5qX0xWB1yZedgkgUvFG5MQ.png" /></figure><h4>Other options</h4><p>When you want to exclude a particular directory, use the -e option. When there are multiple directories, separate them with a comma.</p><pre>$ rails_best_practices -e &quot;db/migrate,vendor&quot; .</pre><p>When a test directory is included, use --test, when a spec directory is included --spec, when a vendor directory is included, use --vendor, and when a features directory is included, use --features.</p><h4>Creating a settings file.</h4><p>The default settings file path is config/rails_best_practices.yml. It is best to begin by generating the base file by adding -g.</p><pre>$ rails_best_practices -g</pre><p>By doing this, YAML files such as the ones below will be generated.</p><pre>AddModelVirtualAttributeCheck: { }<br>AlwaysAddDbIndexCheck: { }<br>#CheckSaveReturnValueCheck: { }<br>#CheckDestroyReturnValueCheck: { }<br>DefaultScopeIsEvilCheck: { }<br>  :</pre><p>For example, when you don’t want to receive warnings about spaces and null lines, use the following settings.</p><pre>RemoveTrailingWhitespaceCheck: { ignored_files: &#39;*&#39; }</pre><p>The suggestions made in rails_best_practices have been written up in an article at <a href="https://rails-bestpractices.com/">Rails Best Practices — Rails Best Practices</a>. It should be easy to understand, as it shows the code before and after modfication. You should be able to code in a much more “Rails-like” way if you make changes after checking the rails_best_practice suggestions in the online article.</p><p>rails_best_practices is also compatible with SideCI’s automatic code review. Although individuals should have no problem installing rails_best_practices locally, when developing as part of a team, checking the suggestions via the cloud should lead to an increase in productivity and of the quality of the code in the project as a whole. I really recommend it.</p><p><a href="https://sideci.com/">SideCI has a free trial. Why not try it out with your Rails projects?</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50fc93384cbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CoffeeLint, Static Analysis Tool Review Your CoffeeScript Code]]></title>
            <link>https://medium.com/@moongift/coffeelint-static-analysis-tool-review-your-coffeescript-code-dd7e031b2479?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7e031b2479</guid>
            <category><![CDATA[coffeelint]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coffeescript]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Tue, 18 Jul 2017 18:01:00 GMT</pubDate>
            <atom:updated>2017-07-18T18:01:00.905Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXEdjQHFDY4rmX8jRuZwoQ.jpeg" /></figure><p>There is no shortage of people who find it difficult to write pure JavaScript. Lots of curly brackets, as well as regular brackets end up making it feel hard to read. It is from those feelings that the alternative language, CoffeeScript, was created. Using a conversion command, CoffeeScript becomes pure Javascript. The language itself has several features that were taken from Ruby and Python, and a simple syntax with good readability.</p><p>CoffeeLint is a static analysis tool made for CoffeeScript. It is certainly true that CoffeeScript is easier to write, but even still, using an analysis tool should point out several issues you may have missed.</p><h4>Installing CoffeeLint</h4><p>CoffeeLint is installed using an npm command.</p><pre>$ npm install coffeelint -g</pre><h4>Using CoffeeLint</h4><p>Using it is easy. Just write the coffeelint command followed by the path of your CoffeeScript project (it can be run on a directory or individual files). Once it has been run any issues it catches will be outputted as described below.</p><pre>$ coffeelint /path/to/coffeescript/project<br>  ✓ calc-test.coffee<br>  ✗ calc.coffee<br>     ✗ #10: Throwing strings is forbidden.<br>  ✗ chartController.coffee<br>     ✗ #16: Line ends with trailing whitespace.<br>  ✗ controller/own_controller.coffee<br>     ✗ #2: Line contains inconsistent indentation. Expected 2 got 1.<br>     ✗ #2: Line contains tab indentation.<br>     ✗ #2: Line ends with trailing whitespace.<br>     ✗ #15: Line contains tab indentation.<br>     ✗ #28: Line contains tab indentation.</pre><p>Afterward, just go along the list of indicated elements and correct each one. CoffeeLint outputs a ✓ for files that don’t have any issues to let you know that it is working.</p><pre>$ coffeelint .<br>  ✓ calc-test.coffee<br>  ✓ calc.coffee<br>  ✓ chartController.coffee<br>  ✓ controller/own_controller.coffee<br>  ✓ db.coffee</pre><h4>Creating a Settings File</h4><p>The settings file for CoffeeScript is the coffeelint.json file. In this file you describe the settings using JSON, but making it from scratch is difficult. That is where you can make use of --makeconfig to generate a base for your file.</p><pre>$ coffeelint --makeconfig &gt; coffeelint.json</pre><p>For more information on the contents of the settings file and issues indicated by the analyzer among other things, please refer to <a href="http://www.coffeelint.org/">CoffeeLint — Lint your CoffeeScript</a>.</p><h4>Applying Custom Rules</h4><p>In CoffeeLint, you can add rules yourself. Taking a look at <a href="https://www.npmjs.com/search?q=coffeelintrule">coffeelintrule — npm search</a> , at the time of writing this, over 50 rules have been created. These rules can be declared as modules in the coffeelint.json file (however, in SideCL, the modules are still not supported).</p><p>For example, the following shows how to add a rule called newline_at_eof that gives a warning when a newline has not been added at the beginning, and the method of changing the settings when you add the coffeelint-newline-at-eof as a module.</p><pre>{<br>    &quot;newline_at_eof&quot;: {<br>        &quot;module&quot;: &quot;coffeelint-newline-at-eof&quot;,<br>        &quot;level&quot;: &quot;warn&quot;<br>    }<br>}</pre><h4>About Options</h4><p>Here is a general introduction to options. When changing the output format, use the --reporter option. For example, in the case of checkstyle the results will be output in CheckStyle format.</p><pre>$ coffeelint --reporter=checkstyle .<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;checkstyle version=&quot;4.3&quot;&gt;<br>&lt;file name=&quot;descriptor.coffee&quot;&gt;<br>&lt;error line=&quot;2&quot;<br>    severity=&quot;error&quot;<br>    message=&quot;Line contains a trailing semicolon; context: &quot;<br>    source=&quot;coffeelint&quot;/&gt;<br>&lt;/file&gt;<br>&lt;/checkstyle&gt;</pre><p>If you set it to csv it will output as a CSV.</p><pre>$ coffeelint --reporter csv .<br>path,lineNumber,lineNumberEnd,level,message<br>descriptor.coffee,2,,error,Line contains a trailing semicolon<br>hello.coffee,2,,error,Line ends with trailing whitespace</pre><p>If you use the --quiet option, nothing will be outputted for files that have no issues, so only errors will be shown.</p><p>CoffeeScript is a simple syntax, but single lines can be long, and it has descriptor issues resulting from the use of white space just like other programming languages. By fixing those issues, the quality of the code can be improved.</p><p>SideCI supports CoffeeScript. For projects using CoffeeScript, please try out CoffeeLint and have it review your code. In particular, you will likely feel the merits of running a code review most strongly when developing with multiple people.</p><p><a href="https://sideci.com/">SideCI — CI for Build Clean Code and Culture</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7e031b2479" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use scss-lint for SCSS static analysis and improving SCSS]]></title>
            <link>https://medium.com/@moongift/use-scss-lint-for-scss-static-analysis-and-improving-scss-f47831a49c3f?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/f47831a49c3f</guid>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[gem]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[scss-lint]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Thu, 13 Jul 2017 18:01:00 GMT</pubDate>
            <atom:updated>2017-07-13T18:01:00.986Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UeycqiwiEp77SELhYaXVOg.jpeg" /></figure><p>When hearing the word code review, it may seem like a system for programs, but that is in fact not the case. Code reviews can be useful for web designers too. For example, CSS is written in text, so you can obtain its difference. If you can code review only its updated parts, you can keep the maintainability while operating daily.</p><p>SCSS which has made extensions on CSS to make it writable, is used widely among web designers as well. If SCSS is used in your development, try using <a href="https://github.com/brigade/scss-lint">scss-lint</a> to check your codes.</p><h4>Installing scss-lint</h4><p>scss-lint can be installed using Rubygems.</p><p>By doing so, you can now use scss-lint commands. When implementing this within your development team, it is useful to additionally write in Gemfile, and manage through bundler, as this enables everyone to use the same version.</p><pre>$ gem install scss-lint</pre><h4>How to use scss-lint</h4><p>It is easy to use scss-lint; all you have to do is to specify a directory or a file containing the SCSS file. When executed, the analysis results will be standard output.</p><pre>$ scss-lint app/assets/stylesheets/<br>app/assets/stylesheets/jobs.css.scss:2:21 [W] HexNotation: Color `#EAEAEA` should be written as `#eaeaea`<br>app/assets/stylesheets/jobs.css.scss:2:21 [W] ColorVariable: Color literals like `#EAEAEA` should only be used in variable declarations; they should be referred to via variable everywhere else.<br>app/assets/stylesheets/jobs.css.scss:4:11 [W] ZeroUnit: `0px` should be written without units as `0`<br>app/assets/stylesheets/jobs.css.scss:12:3 [W] PropertySortOrder: Properties should be ordered background-color, font-family, padding<br>app/assets/stylesheets/jobs.css.scss:14:21 [W] ColorVariable: Color literals like `white` should only be used in variable declarations; they should be referred to via variable everywhere else.</pre><p>It is also very useful because it indicates error items at the same time as outputting how they can be corrected.</p><h4>Displayed results</h4><p>Displayed results can be modified by --format option. For example, to list up the errors which often occur, specify `Stats&#39;. This will make a list of errors in the order of the most frequent, as shown below.</p><pre>$ scss-lint --format Stats app/assets/stylesheets/<br>238  SpaceAfterPropertyColon        (across  6 files)<br>162  SpaceBeforeBrace               (across 10 files)<br> 92  ColorVariable                  (across  8 files)<br> 51  PseudoElement                  (across  5 files)<br> 50  SingleLinePerSelector          (across  9 files)</pre><p>Specifying Files standard outputs simply the names of files which have an error.</p><pre>$ scss-lint --format Files app/assets/stylesheets/<br>app/assets/stylesheets/application.css<br>app/assets/stylesheets/bootstrap-notify.css<br>app/assets/stylesheets/bootstrap-responsive.min.css<br>app/assets/stylesheets/bootstrap-tagmanager.css<br>app/assets/stylesheets/bootstrap.min.css</pre><p>‘TAP` will separate each error, and output them in a more detailed manner.</p><pre>$ scss-lint --format TAP app/assets/stylesheets/ | more<br>TAP version 13<br>1..9514<br>ok 1 - app/assets/stylesheets/ads.css.scss<br>ok 2 - app/assets/stylesheets/api/ads.css.scss<br>ok 3 - app/assets/stylesheets/api/articles.css.scss<br>ok 4 - app/assets/stylesheets/api/users.css.scss<br>not ok 5 - app/assets/stylesheets/application.css:1:1 Comment<br>  ---<br>  message: Use `//` comments everywhere<br>  severity: warning<br>  file: app/assets/stylesheets/application.css<br>  line: 1<br>  column: 1<br>  name: Comment<br>  ...<br>not ok 6 - app/assets/stylesheets/application.css:23:1 SingleLinePerSelector<br>  ---<br>  message: Each selector in a comma sequence should be on its own single line<br>  severity: warning<br>  file: app/assets/stylesheets/application.css<br>  line: 23<br>  column: 1<br>  name: SingleLinePerSelector<br>  ...</pre><h4>What can be checked</h4><p>The check items (Linter) that have been prepared from the beginning, can be checked by --show-linters option.</p><pre>$ scss-lint --show-linters<br>Installed linters:<br> - BangFormat<br> - BemDepth<br> - BorderZero<br> - ChainedClasses<br> - ColorKeyword<br> - ColorVariable<br> - Comment<br>   :</pre><h4>Setting</h4><p>The setting of scss-lint is done in the file named .scss-lint.yml. For example, by the following writing below.</p><pre>scss_files: &#39;app/assets/stylesheets/**/*.css.scss&#39;<br><br>exclude: &#39;app/assets/stylesheets/plugins/**&#39;<br><br>linters:<br>  BorderZero:<br>    enabled: false<br><br>  Indentation:<br>    exclude:<br>      - &#39;path/to/file.scss&#39;<br>      - &#39;path/to/directory/**&#39;<br>    severity: warning<br>    width: 2</pre><p>As the file or directory to analyze is also specified, as long as you have written out the configuration file, it becomes only necessary to use sass-lint command. Also, you can have a setting that activates/deactivates by each check item (Linter) that was mentioned above, or specify in close detail which directory or file to exclude.</p><p>—</p><p>Extended languages such as SCSS and Stylus have been created due to CSS being unable to be structured or be managed altoghether using variables. By using extended languages, it becomes easier to manage, but even so, the overall maintainability often worsens while continuously making updates. In order to prevent this happening, it is important to keep the maintainability by using scss-lint.</p><p>SideCl supports scss-lint, so if you are developing it as a team, please consider implementing scss-lint. It will enable you to test SCSS files by Pull Request base, and perform automatic code reviews.</p><p><a href="https://sideci.com/">We offer free trials as well, so please take this opportunity to give it a try</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f47831a49c3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[If you’re using Haml, let’s do a simple code review using haml-lint]]></title>
            <link>https://medium.com/@moongift/if-youre-using-haml-let-s-do-a-simple-code-review-using-haml-lint-219728612496?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/219728612496</guid>
            <category><![CDATA[haml-lint]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Wed, 12 Jul 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-07-12T18:01:01.345Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JZOHM0sty5Fo--FWupknQ.jpeg" /></figure><p>Haml is a markup language mainly used in Ruby on Rails. It can be described as having less descriptors than ERB, the standard template engine employed by Rails. Because HTML is based on XML, it has a lot of redundant writing, and many people can find it difficult to write with. Because Haml shows the indent structure, it can feel easier to understand when you get used to it. An example of Haml is shown below.</p><pre>%section.container<br>  %h1= post.title<br>  %h2= post.subtitle<br>  .content<br>    = post.content</pre><p>As a result of being displayed as is, even if written appropriately, HTML’s maintenance gradually gets worse as updates pile up. This is the same for Haml. So let’s try using <a href="https://github.com/brigade/haml-lint">haml-lint</a> to perform static analysis on Haml’s contents and identify points that need updating.</p><h4>Installing haml-lint</h4><p>haml-lint can be installed using Rubygems.</p><pre>$ gem install haml_lint</pre><h4>Using haml-lint</h4><p>Basic usage is carried out using the Haml file directory, or the haml-lint command which directs to the Haml file. Doing so creates a stdout file of points that need updating.</p><pre>$ haml-lint .<br>custom_templating_extension.text.html.haml:3 [W] TrailingWhitespace: Line contains trailing whitespace<br>custom_templating_extension.text.plain.haml:5 [W] FinalNewline: Files should end with a trailing newline</pre><p>After this just make updates according to these directions.</p><h4>Output format of results</h4><p>Identification records are output as stdout by default. To change this, use the --reporter option. For example, assign checkstyle to output in CheckStyle format.</p><pre>$ haml-lint --reporter checkstyle .<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;checkstyle version=&quot;5.7&quot;&gt;&lt;file name=&quot;custom_templating_extension.text.html.haml&quot;&gt;&lt;error line=&quot;5&quot; severity=&quot;warning&quot; message=&quot;Files should end with a trailing newline&quot; source=&quot;FinalNewline&quot; /&gt;&lt;error line=&quot;1&quot; severity=&quot;warning&quot; message=&quot;Line contains trailing whitespace&quot; source=&quot;TrailingWhitespace&quot; /&gt;&lt;error line=&quot;3&quot; severity=&quot;warning&quot; message=&quot;Line contains trailing whitespace&quot; source=&quot;TrailingWhitespace&quot; /&gt;&lt;/file&gt;&lt;file name=&quot;custom_templating_extension.text.plain.haml&quot;&gt;&lt;error line=&quot;5&quot; severity=&quot;warning&quot; message=&quot;Files should end with a trailing newline&quot; source=&quot;FinalNewline&quot; /&gt;&lt;error line=&quot;1&quot; severity=&quot;warning&quot; message=&quot;Line contains trailing whitespace&quot; source=&quot;TrailingWhitespace&quot; /&gt;&lt;error line=&quot;3&quot; severity=&quot;warning&quot; message=&quot;Line contains trailing whitespace&quot; source=&quot;TrailingWhitespace&quot; /&gt;&lt;/file&gt;&lt;/checkstyle&gt;</pre><p>This can also be assigned as json.</p><pre>$ haml-lint --reporter json .<br>{&quot;metadata&quot;:{&quot;haml_lint_version&quot;:&quot;0.26.0&quot;,&quot;ruby_engine&quot;:&quot;ruby&quot;,&quot;ruby_patchlevel&quot;:&quot;111&quot;,&quot;ruby_platform&quot;:&quot;x86_64-darwin16&quot;},&quot;files&quot;:[{&quot;path&quot;:&quot;custom_templating_extension.text.html.haml&quot;,&quot;offenses&quot;:[{&quot;severity&quot;:&quot;warning&quot;,&quot;message&quot;:&quot;Files should end with a trailing newline&quot;,&quot;location&quot;:{&quot;line&quot;:5},&quot;linter_name&quot;:&quot;FinalNewline&quot;},{&quot;severity&quot;:&quot;warning&quot;,&quot;message&quot;:&quot;Line contains trailing whitespace&quot;,&quot;location&quot;:{&quot;line&quot;:1},&quot;linter_name&quot;:&quot;TrailingWhitespace&quot;},{&quot;severity&quot;:&quot;warning&quot;,&quot;message&quot;:&quot;Line contains trailing whitespace&quot;,&quot;location&quot;:{&quot;line&quot;:3},&quot;linter_name&quot;:&quot;TrailingWhitespace&quot;}]},{&quot;path&quot;:&quot;custom_templating_extension.text.plain.haml&quot;,&quot;offenses&quot;:[{&quot;severity&quot;:&quot;warning&quot;,&quot;message&quot;:&quot;Files should end with a trailing newline&quot;,&quot;location&quot;:{&quot;line&quot;:5},&quot;linter_name&quot;:&quot;FinalNewline&quot;},{&quot;severity&quot;:&quot;warning&quot;,&quot;message&quot;:&quot;Line contains trailing whitespace&quot;,&quot;location&quot;:{&quot;line&quot;:1},&quot;linter_name&quot;:&quot;TrailingWhitespace&quot;},{&quot;severity&quot;:&quot;warning&quot;,&quot;message&quot;:&quot;Line contains trailing whitespace&quot;,&quot;location&quot;:{&quot;line&quot;:3},&quot;linter_name&quot;:&quot;TrailingWhitespace&quot;}]}],&quot;summary&quot;:{&quot;offense_count&quot;:6,&quot;target_file_count&quot;:2,&quot;inspected_file_count&quot;:2}}</pre><h4>Analyzable contents</h4><p>Analyzable data entries (Linter) can be checked with the --show-linters option. Numerous Linters are prepared by default.</p><pre>$ haml-lint --show-linters<br>Available linters:<br> - AltText<br> - ClassAttributeWithStaticValue<br> - ClassesBeforeIds<br>   :</pre><p>The file .haml-lint.yml controls analyzed contents. The following is an example of these contents. You can change each of the aforementioned Linters to valid or invalid, or minutely change parameters.</p><pre>linters:<br>  ImplicitDiv:<br>    enabled: false<br>    severity: error<br><br>  LineLength:<br>    max: 100</pre><p>Haml does not write tags, so although it is difficult to collapse HTML construction, it’s a format with a high degree of freedom in terms of id and class order etc. As a result, its quality varies according to the coder. Be sure to keep it legible and easy to maintain by using haml-lint.</p><p>haml-lint is supported by SideCI. If being developed by a team, it’s convenient to use SideCI to build automatic code review structures. Be sure to try using it to keep systems maintainable in the long term.</p><p><a href="https://sideci.com/ja">A free trial of SideCI is available</a>. Make sure to try it out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=219728612496" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automatically check JavaScript code using JSHint]]></title>
            <link>https://medium.com/@moongift/automatically-check-javascript-code-using-jshint-c9c1ca1ce2d1?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c1ca1ce2d1</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[jshint]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Tue, 11 Jul 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-07-11T18:01:01.033Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cjTkSB_tm4bs0gBKiAr4SA.jpeg" /></figure><p>In JavaScript, there can be many possible implementations for solving the same problem. There are also many ways for source code to become hard to understand, like the accumulation of unsynchronized processes, so-called “callback hell”. Writing a small script by yourself might not be a problem, but when working on a large web app with multiple developers, the programming language is such that it is easy for problems to arise.</p><p>So, let’s automatically check our code and correct the parts that need fixing. That’s where JSHint comes in handy.</p><h4>JSHint Installation</h4><p>JSHint can be installed with npm command.</p><pre>$ npm install -g jshint</pre><p>The jshint command can now be used.</p><p>You can also install it by including it in the project’s package.json and installing it to the relevant project or directory.</p><h4>How to use JSHint</h4><p>JSHint is most commonly used by directly passing the Javascript/Node.js project you want to analyze to the jshint command. You can pass both files and directories.</p><pre>$ jshint path/to/javascript</pre><p>In Node.js projects, packages that were installed via npm are located in the node_modules directory. Since this directory contains code that we didn’t write ourselves, it would be better if we exclude it from our check. In such a case, we use the --exclude option.</p><pre>$ jshint --exclude=&quot;node_modules/&quot; path/to/javascript</pre><p>When you actually run it, you will find warnings displayed to standard output, as shown below.</p><pre>$ jshint --exclude=&quot;node_modules/&quot; path/to/javascript<br>index.js: line 2, col 3, Comma warnings can be turned off with &#39;laxcomma&#39;.<br>index.js: line 1, col 26, Misleading line break before &#39;,&#39;; readers may interpret this as an expression boundary.<br>index.js: line 9, col 19, [&#39;BOT_URL&#39;] is better written in dot notation.<br>index.js: line 9, col 30, Missing semicolon.<br><br>4 errors</pre><p>Once you’ve read the warnings and made corrections accordingly, if no output is given, then the check is complete.</p><h4>About options</h4><p>--reporter By using this option, you can change the output format. If you select checkstyle, the output will be in an xml format which is compatible with CheckStyle.</p><pre>$ jshint --exclude=&quot;node_modules/&quot; --reporter=checkstyle path/to/javascript<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;checkstyle version=&quot;4.3&quot;&gt;<br>  &lt;file name=&quot;index.js&quot;&gt;<br>    &lt;error line=&quot;9&quot; column=&quot;27&quot; severity=&quot;warning&quot; message=&quot;Missing semicolon.&quot; source=&quot;jshint.W033&quot; /&gt;<br>  &lt;/file&gt;<br>&lt;/checkstyle&gt;</pre><p>If you select unix, it will become easier to count the rows and words.</p><pre>$ jshint --exclude=&quot;node_modules/&quot; --reporter=unix path/to/javascript<br>index.js:9:27: Missing semicolon.<br><br>1 error</pre><p>--extract By using this option, you will be able to check JavaScript written inside html files.</p><pre>$ jshint --exclude=&quot;node_modules/*&quot; --extract=&quot;auto&quot; index.html <br>index.html: line 16, col 46, Missing semicolon.<br><br>1 error</pre><h4>Settings</h4><p>Settings can be specified with a file named .jshintrc. The contents are a JSON file, as shown below. The following returns an error if undefined variables are used; it also returns an error if variables are unused. It also designates MY_GLOBAL as a global variable, to prevent it giving errors for being undefined.</p><pre>{<br>  &quot;undef&quot;: true,<br>  &quot;unused&quot;: true,<br>  &quot;globals&quot;: {<br>    &quot;MY_GLOBAL&quot;: true<br>  }<br>}</pre><p>You can also define these in comments in each Javascript file. Use whichever is easier.</p><pre>/* jshint undef: true, unused: true */<br>/* globals MY_GLOBAL */</pre><p>To check files written in ES6, specify /*jshint esversion: 6 */. Of course you can apply this to everything by using .jshintrc.</p><p>Also, lines which you want excluded from the check should have // jshint ignore:line appended. For other options, refer to <a href="http://jshint.com/docs/options/">JSHint Options Reference</a>.</p><p>JSHint has been maintained for a long time. It is packed full of all sorts of knowhow. It may have fewer functions than other analyzers, but all the ones that you will need.</p><p>The SideCI automatic code review tool is compatible with JSHint. Individual users can install JSHint locally. Development teams are invited to try SideCI, which can apply automatic code review to individual Pull Requests on GitHub.</p><p><a href="https://sideci.com/">SideCI can be trialed for free. Do consider using it with your Rails project</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c1ca1ce2d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Brakeman prevents security incidents with Rails projects]]></title>
            <link>https://medium.com/@moongift/prevent-security-incidents-with-rails-projects-using-brakeman-6fb103ea4185?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fb103ea4185</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[brakeman]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Thu, 06 Jul 2017 18:01:00 GMT</pubDate>
            <atom:updated>2017-07-07T06:35:00.146Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVn3s6hbp7pappEpsKDPfw.jpeg" /></figure><p>In this article, we discuss about Brakeman. After the introduction of Rails, Ruby started to be used for web development the world over. Rails is a full-featured and convenient framework, but perhaps because of this feeling that Rails will take care of everything for you, it is sometimes used carelessly, without regard for security. If one writes code carelessly, it’s easy to end up creating code that can become the cause of security incidents.</p><p>That’s why you want to use <a href="https://github.com/presidentbeef/brakeman">Brakeman</a> . Brakeman is a tool that will conduct a static analysis your Rails project with an emphasis on security.</p><h4>Installing Brakeman</h4><p>Brakeman can be installed with Rubygems.</p><pre>$ gem install brakeman</pre><p>Of course, it’s also possible to install by entering a line in the Gemfile of your Rails project.</p><pre>group :development do<br>  gem &#39;brakeman&#39;, :require =&gt; false<br>end</pre><h4>Using Brakeman</h4><p>To use, just run the brakeman command in your Rails project.</p><pre>$ brakeman /path/to/rails/project</pre><p>When you do, the analysis will run and output the results. For example, results such as the ones below will appear. There might be a redirect, or a warning regarding views.</p><pre>+BRAKEMAN REPORT+<br><br>Application path: /path/to/rails/project<br>Rails version: 4.2.8<br>Brakeman version: 3.6.2<br>Started at 2017-06-11 16:22:29 +0900<br>Duration: 0.357863 seconds<br>Checks run: BasicAuth, BasicAuthTimingAttack, ContentTag, CreateWith, CrossSiteScripting, DefaultRoutes, Deserialize, DetailedExceptions, DigestDoS, DynamicFinders, EscapeFunction, Evaluation, Execute, FileAccess, FileDisclosure, FilterSkipping, ForgerySetting, HeaderDoS, I18nXSS, JRubyXML, JSONEncoding, JSONParsing, LinkTo, LinkToHref, MailTo, MassAssignment, MimeTypeDoS, ModelAttrAccessible, ModelAttributes, ModelSerialize, NestedAttributes, NestedAttributesBypass, NumberToCurrency, QuoteTableName, Redirect, RegexDoS, Render, RenderDoS, RenderInline, ResponseSplitting, RouteDoS, SQL, SQLCVEs, SSLVerify, SafeBufferManipulation, SanitizeMethods, SelectTag, SelectVulnerability, Send, SendFile, SessionManipulation, SessionSettings, SimpleFormat, SingleQuotes, SkipBeforeFilter, StripTags, SymbolDoSCVE, TranslateBug, UnsafeReflection, ValidationRegex, WithoutProtection, XMLDoS, YAMLParsing<br><br><br>+SUMMARY+<br><br>+-------------------+-------+<br>| Scanned/Reported  | Total |<br>+-------------------+-------+<br>| Controllers       | 14    |<br>| Models            | 7     |<br>| Templates         | 23    |<br>| Errors            | 0     |<br>| Security Warnings | 8 (1) |<br>+-------------------+-------+<br><br>+----------------------+-------+<br>| Warning Type         | Total |<br>+----------------------+-------+<br>| Cross Site Scripting | 5     |<br>| Dynamic Render Path  | 2     |<br>| Redirect             | 1     |<br>+----------------------+-------+<br><br><br>+SECURITY WARNINGS+<br><br>+------------+-------------------+----------+----------------------+-------------------------------------------------------------------------------------------------------------------&gt;&gt;<br>| Confidence | Class             | Method   | Warning Type         | Message                                                                                                           &gt;&gt;<br>+------------+-------------------+----------+----------------------+-------------------------------------------------------------------------------------------------------------------&gt;&gt;<br>| High       | OauthsController  | callback | Redirect             | Possible unprotected redirect near line 14: redirect_to(+Bot.find_by_domain(request.host.split(&quot;.&quot;)[0]).admin_edit&gt;&gt;<br>| Medium     | ScriptsController | show     | Cross Site Scripting | Unescaped model attribute rendered inline near line 9: render(text =&gt; +ChatLog.find_by_uniq_key(params[:id]).bot.c&gt;&gt;<br>+------------+-------------------+----------+----------------------+-------------------------------------------------------------------------------------------------------------------&gt;&gt;<br><br><br>View Warnings:<br><br>+------------+------------------------------------------------+----------------------+-------------------------------------------------------------------------------------------------&gt;&gt;<br>| Confidence | Template                                       | Warning Type         | Message                                                                                         &gt;&gt;<br>+------------+------------------------------------------------+----------------------+-------------------------------------------------------------------------------------------------&gt;&gt;<br>| Medium     | shared/_bot_header (Template:admin/bots/index) | Cross Site Scripting | Unsafe model attribute in link_to href near line 12: link_to(+current_user.bots.find_by_domain(r&gt;&gt;<br>| Medium     | shared/_bot_header (Template:admin/bots/index) | Cross Site Scripting | Unsafe model attribute in link_to href near line 17: link_to(+current_user.bots.find_by_domain(r&gt;&gt;<br>| Medium     | docs/show (DocsController#show)                | Dynamic Render Path  | Render path contains parameter value near line 4: render(partial =&gt; &quot;shared/doc_#{+params[:id].g&gt;&gt;<br>| Medium     | docs/show (DocsController#show)                | Dynamic Render Path  | Render path contains parameter value near line 9: render(partial =&gt; &quot;shared/doc_#{+params[:id].g&gt;&gt;<br>| Weak       | bots/show (BotsController#index)               | Cross Site Scripting | Unescaped model attribute near line 17: markdown.render(strip_tags(+Bot.find_by_domain(request.h&gt;&gt;<br>| Weak       | bots/show (BotsController#index)               | Cross Site Scripting | Unescaped model attribute near line 24: markdown.render(strip_tags(+Bot.find_by_domain(request.h&gt;&gt;<br>+------------+------------------------------------------------+----------------------+-------------------------------------------------------------------------------------------------&gt;&gt;</pre><p>Afterwards, just follow these instructions and edit your project in order to fix the issues.</p><p>In addition to the standard output, result content may also be outputted in HTML/JSON/CSV/TSV/Markdown/Code Climate. Each can be selected with an extension or -f option. Multiple file output is also supported, so it&#39;s easier to indicate your preference with an extension.</p><pre>$ brakeman -o output.html -o output.json</pre><h4>Supported Versions of Rails, etc.</h4><p>Brakeman can be used with a wide selection of Rails versions, from 2.3 to 5.x. It can also be used to for a syntactic analysis of Ruby 1.8, but the version of Ruby itself must be 1.9.3 or higher.</p><h4>Comparing Results with Past Data</h4><p>Using the --compare option allows you to make comparisons with past results. This feature uses JSON files, so it will be necessary to prepare a JSON file as output. If you do so, it will be easy to confirm when new problems are occurring (or when they&#39;ve been fixed).</p><pre>$ brakeman --compare  output.json<br>Checks finished, collecting results...<br>{<br>  &quot;new&quot;: [<br>    {<br>      &quot;warning_type&quot;: &quot;Cross Site Scripting&quot;,<br>      &quot;warning_code&quot;: 84,<br>      &quot;fingerprint&quot;: &quot;947ce5634858e206076c3d1f6379c11ccb62aa3430b427150975388a5d3c4a68&quot;,<br>      &quot;check_name&quot;: &quot;RenderInline&quot;,<br>      &quot;message&quot;: &quot;Unescaped parameter value rendered inline&quot;,<br>      &quot;file&quot;: &quot;app/controllers/bots_controller.rb&quot;,<br>      &quot;line&quot;: 15,<br>      &quot;link&quot;: &quot;http://brakemanscanner.org/docs/warning_types/cross_site_scripting/&quot;,<br>      &quot;code&quot;: &quot;render(text =&gt; params[\&quot;hub.challenge\&quot;], { :layout =&gt; false })&quot;,<br>      &quot;render_path&quot;: null,<br>      &quot;location&quot;: {<br>        &quot;type&quot;: &quot;method&quot;,<br>        &quot;class&quot;: &quot;BotsController&quot;,<br>        &quot;method&quot;: &quot;index&quot;<br>      },<br>      &quot;user_input&quot;: &quot;params[\&quot;hub.challenge\&quot;]&quot;,<br>      &quot;confidence&quot;: &quot;High&quot;<br>    }<br>  ],<br>  &quot;fixed&quot;: [<br><br>  ]<br>}</pre><h4>With Heavy Rails Projects</h4><p>Rails has a tendency towards being a monolithic system, so it’s easy for the scope of your project to grow quite large. Because of this, it may take a while for Brakeman to run a check. If so, you can use the --faster option to speed up the analysis. Although this option does run more quickly, it checks fewer items.</p><h4>Creating a Settings File</h4><p>Just as with other static analysis tools, the categories checked by Brakeman can be controlled with a settings file. For each of Brakeman’s featured warnings and notices, you can decided whether to disable or enable with a dialog. The settings file will be saved under config/brakeman.ignore. If you&#39;d like to generate one, use the -I option.</p><pre>$ brakeman -I<br>  :<br>Checks finished, collecting results...<br>Filtering warnings...<br>Input file: |config/brakeman.ignore|        	<br>No such file. Continue with empty config? y<br>1. Inspect all warnings<br>2. Hide previously ignored warnings<br>3. Prune obsolete ignored warnings<br>4. Skip - use current ignore configuration<br>?  1<br>--------------------<br>Actions:<br>i - Add warning to ignore list<br>n - Add warning to ignore list and add note<br>s - Skip this warning (will remain ignored or shown)<br>u - Remove this warning from ignore list<br>a - Ignore this warning and all remaining warnings<br>k - Skip this warning and all remaining warnings<br>q - Quit, do not update ignored warnings<br>? - Display this help<br>--------------------<br>Confidence: Weak<br>Category: Cross Site Scripting<br>Message: Unescaped model attribute<br>Code: markdown.render(strip_tags(Bot.find_by_domain(request.host.split(&quot;.&quot;)[0]).readme.to_s))<br>File: app/views/bots/show.html.erb<br>Line: 17<br>Action: (i, n, k, u, a, s, q, ?) i<br>--------------------<br>Ignoring 8 warnings<br>Showing 0 warnings<br>1. Save changes<br>2. Start over<br>3. Quit, do not save changes<br>?  1<br>Output file: |config/brakeman.ignore|</pre><p>If you use this setting file to disable all of the warnings, you will stop receiving them afterwards. This isn’t a good situation, so it’s best to confirm the contents and quickly correct the items which need to be fixed. Once you’ve confirmed that an item isn’t a problem, it’s alright to leave it disabled.</p><p>Rails is a framework with a very high level of features, but that doesn’t mean it’s fully secure. The same can be said for any programming language or framework. Small mistakes can lead to security incidents. By using Brakeman, you may be able to discover some of these problems and fix them.</p><p>SideCI’s automatic code review also supports Brakeman. For individual developers, just install Brakeman locally and you’re done. However, for teams-oriented development systems, checking in the cloud is the more effective way to improve the quality of all of the project’s code.</p><p><a href="https://sideci.com/">You can get a free trial from SideCI. Give it a try it with your Rails project!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fb103ea4185" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s use the TypeScript static code analysis tool TSLint to check the code prior to the code…]]></title>
            <link>https://medium.com/@moongift/lets-use-the-typescript-static-code-analysis-tool-tslint-to-check-the-code-prior-to-the-code-10f1718a1c17?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/10f1718a1c17</guid>
            <category><![CDATA[tslint]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Wed, 05 Jul 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-07-05T18:01:01.063Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s use the TypeScript static code analysis tool TSLint to check the code prior to the code review</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DyhGJcZWYrCZW_nFhPKacQ.jpeg" /></figure><p>There are quite a few people in the team who dislike using JavaScript as it is. Common reasons include difficulties in defining types, there being too many parentheses, and codes often becoming too difficult to understand. That is why Microsoft has been mainly developing TypeScript, a substitute language for JavaScript. TypeScript can be converted to JavaScript.</p><p>Even with TypeScript, however, it is necessary to conduct a proper code review in team development. Here, we introduce TSLint, which is a static code analysis tool that can make it even easier in the stages before the review, and in the development stage.</p><h4>Installing TSLint</h4><p>Install TSLint with npm command.</p><pre>$ npm install tslint -g</pre><p>Once installed, you can use tslint command.</p><h4>How to use TSLint</h4><p>TSLint specifies the .ts of the target file for analysis and executes it. Multiple files can also be selected by specifying a pattern. When executed, points that have been modified for the better will be output.</p><pre>$ tslint &#39;./*.ts&#39;<br><br>ERROR: ajv.d.ts[156, 21]: Array type using &#39;Array&lt;T&gt;&#39; is forbidden for simple types. Use &#39;T[]&#39; instead.<br>ERROR: ajv.d.ts[15, 28]: Don&#39;t use &#39;Object&#39; as a type. Avoid using the `Object` type. Did you mean `object`?<br>ERROR: ajv.d.ts[7, 13]: interface name must start with a capitalized I<br>ERROR: ajv.d.ts[219, 13]: interface name must start with a capitalized I</pre><p>All that is left is to make corrections according to the specified items.</p><h4>Automatic correction</h4><p>If there are common problems (e.g., spaces at the end of the line), you can use the --fix option to automatically fix it.</p><pre>$ tslint --fix &#39;./*.ts&#39;</pre><p>This option does not modify the maximum number of characters in a line, the description in JSDoc, how variable names are assigned (the interface should start with an uppercase I), and so on. It is necessary to manually respond to these indications.</p><h4>Change settings</h4><p>Like other analyzers, TSLint can be changed in the settings file. First, use the --init option to generate a base configuration file tslint.json. The contents are as follows.</p><pre>$ cat tslint.json <br>{<br>    &quot;defaultSeverity&quot;: &quot;error&quot;,<br>    &quot;extends&quot;: [<br>        &quot;tslint:recommended&quot;<br>    ],<br>    &quot;jsRules&quot;: {},<br>    &quot;rules&quot;: {},<br>    &quot;rulesDirectory&quot;: []<br>}</pre><p>By editing this configuration file you can limit the items being highlighted.</p><h4>Change the output format</h4><p>By default, it will simply issue an error message to standard output, but by specifying the --format option, it will be able to output in a different format. For example, if you specify `json&#39;, the result will be JSON.</p><pre>[{&quot;endPosition&quot;:{&quot;character&quot;:33,&quot;line&quot;:14,&quot;position&quot;:658},&quot;failure&quot;:&quot;Don&#39;t use &#39;Object&#39; as a type. Avoid using the `Object` type. Did you mean `object`?&quot;,&quot;name&quot;:&quot;ajv.d.ts&quot;,&quot;ruleName&quot;:&quot;ban-types&quot;,&quot;ruleSeverity&quot;:&quot;ERROR&quot;,&quot;startPosition&quot;:{&quot;character&quot;:27,&quot;line&quot;:14,&quot;position&quot;:652}},{&quot;endPosition&quot;:{&quot;character&quot;:25,&quot;line&quot;:195,&quot;position&quot;:7585},&quot;failure&quot;:&quot;Don&#39;t use &#39;Object&#39; as a type. Avoid using the `Object` type. Did you mean `object`?&quot;,&quot;name&quot;:&quot;ajv.d.ts&quot;,&quot;ruleName&quot;:&quot;ban-types&quot;,&quot;ruleSeverity&quot;:&quot;ERROR&quot;,&quot;startPosition&quot;:{&quot;character&quot;:19,&quot;line&quot;:195,&quot;position&quot;:7579}}]</pre><p>In addition to JSON, the supported formats are: stylish / verbose / pmd / msbuild / checkstyle / vso / fileslist / codeFrame.</p><p>Although TypeScript is widely being used at major companies, there are also cases where SMEs and start-ups are adopting it because of its compatibility with casual programming editors such as Visual Studio Code. If you are using TypeScript at your company, it’s a good idea to use TSLint.</p><p>Our SideCI is compatible with TSLint. For individual development, it can be installed locally; for team development, a mechanism that automatically performs code review on the cloud will be more efficient.</p><p><a href="http://sideci.com/en">SideCI offers a free trial</a>. Please try it out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10f1718a1c17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Utilize gometalinter which can parallel execute wholly, all kinds of Linter for the Go language]]></title>
            <link>https://medium.com/@moongift/utilize-gometalinter-which-can-parallel-execute-wholly-all-kinds-of-linter-for-the-go-language-b3a8edbdd89?source=rss-9cad8a2aea40------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3a8edbdd89</guid>
            <category><![CDATA[golint]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[go-vet]]></category>
            <category><![CDATA[gometalinter]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Atsushi Nakatsugawa]]></dc:creator>
            <pubDate>Tue, 04 Jul 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-07-04T18:01:01.433Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JnT1z-AGq6HVkpCiLKxVA.jpeg" /></figure><p>Many programming languages have a tool which you could call Linter, that performs the static analysis of its codes and outputs warnings. Especially recent programming languages seem to often have Linter. By having Linter, the way to write good codes accumulate inside Linter’s source code, and can be used for a better development process.</p><p>Similarly, Linter exists for the Go language. However, in contrast to other languages, a large number of Linters exist to correspond to each objective. In languages like Python, Ruby, and PHP, there are 10 or less mainly used Linters, while in the Go language, more than 20 Linters exist as of today, when we write this article. Using each one of them to check is very time consuming. Therefore, we would like to introduce to you gometalinter, which can wholly parallel execute all of these Linters, and normalize the results and rearrange them so they are easier to see.</p><h4>Install gometalinter</h4><p>Gometalinter can be installed by using the go command.</p><pre>go get -u github.com/alecthomas/gometalinter</pre><p>Gomentalinter itself does not have a Lint function, so it is necessary to install an external Lint tool. You can install it all at once by using the --install option.</p><pre>$ gometalinter --install<br>Installing:<br>  interfacer<br>    :<br>  misspell</pre><p>Set up is now complete. The supported tools are as shown below.</p><ul><li><a href="https://golang.org/cmd/vet/">go vet</a></li><li><a href="https://golang.org/cmd/vet/#hdr-Shadowed_variables">go vet — shadow</a></li><li><a href="https://golang.org/x/tools/cmd/gotype">gotype</a></li><li><a href="https://github.com/tsenart/deadcode">deadcode</a></li><li><a href="https://github.com/alecthomas/gocyclo">gocyclo</a></li><li><a href="https://github.com/golang/lint">golint</a></li><li><a href="https://github.com/opennota/check">varcheck</a></li><li><a href="https://github.com/opennota/check">structcheck</a></li><li><a href="https://github.com/opennota/check">aligncheck</a></li><li><a href="https://github.com/kisielk/errcheck">errcheck</a></li><li><a href="https://github.com/mibk/dupl">dupl</a></li><li><a href="https://github.com/gordonklaus/ineffassign/blob/master/list">ineffassign</a></li><li><a href="https://github.com/mvdan/interfacer">interfacer</a></li><li><a href="https://github.com/mdempsky/unconvert">unconvert</a></li><li><a href="https://github.com/jgautheron/goconst">goconst</a></li><li><a href="https://github.com/dominikh/go-tools/tree/master/cmd/gosimple">gosimple</a></li><li><a href="https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck">staticcheck</a></li><li><a href="https://github.com/GoASTScanner/gas">gas</a></li></ul><p>The following Linters are deactivated by default, so in order to use them, you need to specify so by the --enable option.</p><ul><li><a href="https://github.com/stretchr/testify">testify</a></li><li><a href="http://golang.org/pkg/testing/">test</a></li><li><a href="https://golang.org/cmd/gofmt/">gofmt -s</a></li><li><a href="https://godoc.org/golang.org/x/tools/cmd/goimports">goimports</a></li><li><a href="https://github.com/walle/lll">lll</a></li><li><a href="https://github.com/client9/misspell">misspell</a></li><li><a href="https://github.com/mvdan/unparam">unparam</a></li><li><a href="https://github.com/dominikh/go-tools/tree/master/cmd/unused">unused</a></li><li><a href="https://github.com/stripe/safesql">safesql</a></li></ul><h4>How to use gometalinter</h4><p>Using gometalinter is easy; all you have to do is specify an arbitrary file or directory of Go project, and execute gometalinter. When executed, you will see an output showing which file has been indicated with what kind of point and where.</p><pre>$ gometalinter .<br>options.go:21:1:warning: ALL is unused (deadcode)<br>datastore.go:19:6:warning: don&#39;t use underscores in Go names; type memberinfo_st should be memberinfoSt (golint)<br>main.go:25:7:warning: don&#39;t use underscores in Go names; const sw_version should be swVersion (golint)<br>tagsparser.go:142:6:warning: don&#39;t use underscores in Go names; func datatype_supported should be datatypeSupported (golint)<br>dotmaker.go:46:8:warning: should omit comparison to bool constant, can be simplified to opt_blackbox (S1002) (gosimple)</pre><p>Then, you just have to make corrections according to those points.</p><h4>Options</h4><p>Here, you will find an introduction of the main options. Firstly, if you want to exclude something from static analysis, you can specify it by using the --exclude option.</p><pre>$ gometalinter --exclude options.go .</pre><p>Many Linters are used, so you can use the --sort option to order them differently. What you can specify are the following: path/line/column/severity/message/linter.</p><pre>$ gometalinter --sort=linter .</pre><p>If you want to change the output format, you can specify it by using --checkstyle or --json. This will output in CheckStyle format and JSON format respectively.</p><h4>Configuration file</h4><p>In the same way as other Lint tool, you can change how gomentalinter works through its configuration file. By default, this file is named config.go. For example, you can write it as shown below. As you can see, first you have to deactivate all Linter, and then afterwards, specify which Linter to use.</p><pre>{<br>  &quot;DisableAll&quot;: true,<br>  &quot;Enable&quot;: [&quot;deadcode&quot;, &quot;unconvert&quot;]<br>}</pre><p>Using gometalinter will enable you to manage the many number of Lint tools all together. Each tool has a different concept, so the points indicated will also be different. Being able to pass all tools is not a necessity, but if a code can pass many tools, it will mean that the code is of high quality to be able to do so.</p><p>SideCl supports gometalinter. If your teams is implementing Go Project, please use gometalinter. <a href="https://sideci.com/ja">We offer free trials as well, so please first give it a try.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3a8edbdd89" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>