ambition/tmp/metric_fu/output/28f48e0bc2718ddf87752d15b58...

918 lines
23 KiB
HTML
Raw Permalink Normal View History

2017-01-03 10:51:58 +08:00
<html>
<head>
<style>
table { background: #fff; color: #000; }
.ruby .normal { color: #000; }
.ruby .comment { color: #005; font-style: italic; }
.ruby .keyword { color: #A44; font-weight: bold; }
.ruby .method { color: #44f; }
.ruby .class { color: #b1713d; }
.ruby .module { color: #050; }
.ruby .punct { color: #668; font-weight: bold; }
.ruby .symbol { color: #00f; }
.ruby .string { color: #4a4; }
.ruby .char { color: #F07; }
.ruby .ident { color: #000; }
.ruby .constant { color: #b1713d; }
.ruby .regex { color: #B66; background: #FEF; }
.ruby .number { color: #F99; }
.ruby .attribute { color: #f84; }
.ruby .global { color: #7FB; }
.ruby .expr { color: #227; }
.ruby .escape { color: #277; }
</style>
<title>Analyzed File Report</title>
</head>
<body>
<table cellpadding='0' cellspacing='0' class='ruby'>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span><span class="keyword">class</span> <span class="class">UsersController</span> &lt; <span class="constant">ApplicationController</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n2" name="n2">2</a></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n3" name="n3">3</a></span> before_action <span class="symbol">:authenticate</span>, <span class="key">except</span>: [ <span class="symbol">:emailExist</span>, <span class="symbol">:usernameExist</span>, <span class="symbol">:create</span> ]
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n4" name="n4">4</a></span> skip_before_action <span class="symbol">:verify_authenticity_token</span>, <span class="symbol">:only</span> =&gt; [
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n5" name="n5">5</a></span> <span class="symbol">:emailExist</span>,
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n6" name="n6">6</a></span> <span class="symbol">:usernameExist</span>,
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n7" name="n7">7</a></span> <span class="symbol">:create</span>,
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n8" name="n8">8</a></span> <span class="symbol">:update</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"> <a href="#n9" name="n9">9</a></span> ]
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><strong><a href="#n10" name="n10">10</a></strong></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
<ul>
<li>Complexity 2 &raquo; saikuro</li>
<li>Method name "emailExist" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ &raquo; roodi</li>
<li>UncommunicativeMethodName - has the name 'emailExist' &raquo; reek</li>
</ul>
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n11" name="n11">11</a></span> <span class="keyword">def</span> <span class="function">emailExist</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n12" name="n12">12</a></span> <span class="keyword">if</span> checkExist?(<span class="symbol">:email</span>, params[<span class="symbol">:email</span>])
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n13" name="n13">13</a></span> render <span class="symbol">:text</span> =&gt; <span class="string"><span class="delimiter">'</span><span class="content">1</span><span class="delimiter">'</span></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n14" name="n14">14</a></span> <span class="keyword">else</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n15" name="n15">15</a></span> render <span class="symbol">:text</span> =&gt; <span class="string"><span class="delimiter">'</span><span class="content">0</span><span class="delimiter">'</span></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n16" name="n16">16</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n17" name="n17">17</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n18" name="n18">18</a></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
<ul>
<li>Complexity 2 &raquo; saikuro</li>
<li>Method name "usernameExist" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ &raquo; roodi</li>
<li>UncommunicativeMethodName - has the name 'usernameExist' &raquo; reek</li>
</ul>
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n19" name="n19">19</a></span> <span class="keyword">def</span> <span class="function">usernameExist</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><strong><a href="#n20" name="n20">20</a></strong></span> <span class="keyword">if</span> checkExist?(<span class="symbol">:name</span>, params[<span class="symbol">:username</span>])
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n21" name="n21">21</a></span> render <span class="symbol">:text</span> =&gt; <span class="string"><span class="delimiter">'</span><span class="content">exist</span><span class="delimiter">'</span></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n22" name="n22">22</a></span> <span class="keyword">else</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n23" name="n23">23</a></span> render <span class="symbol">:text</span> =&gt; <span class="string"><span class="delimiter">'</span><span class="content">not exist</span><span class="delimiter">'</span></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n24" name="n24">24</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n25" name="n25">25</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n26" name="n26">26</a></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
<ul>
<li>Complexity 2 &raquo; saikuro</li>
</ul>
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n27" name="n27">27</a></span> <span class="keyword">def</span> <span class="function">create</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n28" name="n28">28</a></span> <span class="instance-variable">@user</span> = <span class="constant">User</span>.new(user_params)
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n29" name="n29">29</a></span> <span class="keyword">if</span> <span class="instance-variable">@user</span>.save
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><strong><a href="#n30" name="n30">30</a></strong></span> render <span class="key">status</span>: <span class="symbol">:created</span>, <span class="key">nothing</span>: <span class="predefined-constant">true</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n31" name="n31">31</a></span> <span class="keyword">else</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n32" name="n32">32</a></span> render <span class="key">json</span>: <span class="instance-variable">@user</span>.errors, <span class="key">status</span>: <span class="symbol">:unprocessable_entity</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n33" name="n33">33</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n34" name="n34">34</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n35" name="n35">35</a></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
<ul>
<li>Complexity 2 &raquo; saikuro</li>
</ul>
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n36" name="n36">36</a></span> <span class="keyword">def</span> <span class="function">update</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n37" name="n37">37</a></span> <span class="instance-variable">@user</span> = current_user
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n38" name="n38">38</a></span> <span class="keyword">if</span> <span class="instance-variable">@user</span>.update(user_params)
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n39" name="n39">39</a></span> render <span class="string"><span class="delimiter">'</span><span class="content">show</span><span class="delimiter">'</span></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><strong><a href="#n40" name="n40">40</a></strong></span> <span class="keyword">else</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n41" name="n41">41</a></span> render <span class="key">json</span>:current_user.errors, <span class="key">status</span>: <span class="symbol">:unprocessable_entity</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n42" name="n42">42</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n43" name="n43">43</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n44" name="n44">44</a></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n45" name="n45">45</a></span> private
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
<ul>
<li>Complexity 1 &raquo; saikuro</li>
<li>Method name "checkExist?" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ &raquo; roodi</li>
<li>UtilityFunction - doesn't depend on instance state &raquo; reek</li>
<li>UncommunicativeMethodName - has the name 'checkExist?' &raquo; reek</li>
</ul>
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n46" name="n46">46</a></span> <span class="keyword">def</span> <span class="function">checkExist?</span>(field_name, value)
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n47" name="n47">47</a></span> <span class="constant">User</span>.exists?(field_name =&gt; value)
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n48" name="n48">48</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n49" name="n49">49</a></span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
<ul>
<li>Complexity 1 &raquo; saikuro</li>
</ul>
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><strong><a href="#n50" name="n50">50</a></strong></span> <span class="keyword">def</span> <span class="function">user_params</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n51" name="n51">51</a></span> params.require(<span class="symbol">:user</span>).permit(<span class="symbol">:name</span>,<span class="symbol">:password</span>, <span class="symbol">:password_confirmation</span>, <span class="symbol">:email</span>, <span class="symbol">:phone</span>)
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n52" name="n52">52</a></span> <span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
<tr>
<td valign='top'>
&nbsp;
</td>
<td valign='top'>
<div class="CodeRay">
<div class="code"><pre><span class="line-numbers"><a href="#n53" name="n53">53</a></span><span class="keyword">end</span>
</pre></div>
</div>
</td>
</tr>
</table>
</body>
</html>