Showing 426 of 426 total issues
Method check
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'empty_alt_attr_of_img_inside_a', self::$unspec, 1);
$str = Element\Get::ignoredHtml($url);
Method criterion
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function criterion()
{
// value check
$criterions = Yaml::each('criterions');
$criterion = Input::param('criterion', '');
Method form
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function form($url, $users = array(), $current_user_id = null)
{
// dbio
if (Input::isPostExists())
{
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (in_array($attrs['type'], array('text', 'checkbox', 'radio', 'file', 'password')))
{
$eles[$k]['tag'] = $ms[0][$k];
$eles[$k]['tag_name'] = $ms[1][$k];
$eles[$k]['title'] = isset($attrs['title']) ? $attrs['title'] : '';
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
elseif (in_array($m, array('textarea', 'select')))
{
$eles[$k]['tag'] = $ms[0][$k];
$eles[$k]['tag_name'] = $ms[1][$k];
$eles[$k]['title'] = isset($attrs['title']) ? $attrs['title'] : '';
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'duplicated_ids', self::$unspec, 1);
Validate\Set::log($url, 'duplicated_accesskeys', self::$unspec, 1);
$str = Element\Get::ignoredHtml($url);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function get($array, $key, $default = null)
{
if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
{
// throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function duplicatedNames
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function duplicatedNames($k, $url, $whole_form, $v, $action)
{
preg_match_all("/\<(?:input|select|textarea) .+?\>/si", $whole_form, $names);
if (isset($names[0]))
{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'empty_link_element', self::$unspec, 1);
$str = Element\Get::ignoredHtml($url);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setDeleteElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function setDeleteElement($eles, $fors)
{
$del_eles = array();
foreach ($fors as $for)
{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function updateChecks
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function updateChecks($url)
{
$bulk = Input::postArr('chk');
$vals = array();
$loops = array(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fetchAll
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function fetchAll($force = false, $version = null, $group_id = null)
{
if ( ! is_null(static::$vals) && ! $force) return static::$vals;
$ret = static::fetchRaw($version, $group_id);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function issue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function issue($users = array(), $current_user_id = NULL, $is_admin = false)
{
$id = intval(Input::get('id'));
$issue = Model\Issue::fetch($id);
if (empty($issue) || Arr::get($issue, 'trash') == 1) Util::error('issue not found');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method forge
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function forge($controller = '\A11yc\Controller\Center', $action = 'actionIndex')
{
// vals
$c = Input::get('c', '');
$a = Input::get('a', '');
Method collectFormItems
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function collectFormItems($ms)
{
$form_items = array('<form ', '</form' ,'<label', '<input', '<select', '<texta', '<butto');
$forms = array();
$n = 0;
Method get
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function get()
{
// don't call twice
if (isset($this->body) && $this->body) return true;
$url = $this->url;
Method get
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get($array, $key, $default = null)
{
if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
{
// throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
Method uniqueLabel
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function uniqueLabel($k, $url, $whole_form, $v)
{
preg_match_all("/\<label[^\>]*?\>(.+?)\<\/label\>/is", $whole_form, $ms);
if (isset($ms[1]))
Method update
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function update()
{
if ( ! Db::isTableExist(A11YC_TABLE_SETTINGS)) return;
self::serialize2json(); // trait AddDataUtil
Method index
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function index()
{
// fetch pages
$list = Input::get('list', 'all');
$words = Util::searchWords2Arr(Input::get('s', ''));