Showing 426 of 426 total issues
Function check
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'css_is_meanfull_content', self::$unspec, 5);
if ( ! static::$do_css_check) return;
Validate\Set::log($url, 'css_is_meanfull_content', self::$unspec, 1);
- 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 doEvaluate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function doEvaluate($cs, $ngs, $yml)
{
// passed
$passed = self::passed($cs, $yml);
- 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 addErrorToHtml
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addErrorToHtml(
$url,
$error_id,
$s_errors,
$ignore_vals = '',
Function check
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'meanless_element', self::$unspec, 1);
Validate\Set::log($url, 'meanless_element_timing', 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 check
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'meta_refresh', self::$unspec, 5);
if (Validate::$is_partial === true) return;
Validate\Set::log($url, 'meta_refresh', self::$unspec, 1);
- 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 collectFormItems
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private static function collectFormItems($ms)
{
$form_items = array('<form ', '</form' ,'<label', '<input', '<select', '<texta', '<butto');
$forms = array();
$n = 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 filter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function filter($vals, $fields)
{
foreach ($fields as $k => $v)
{
$vals[$k] = Arr::get($vals, $k, $v);
- 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 prepareStrings
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function prepareStrings($str)
{
// escaped quote
$str = str_replace(
array("\\'", '\\"'),
File AddData.php
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* A11yc\Update\AddData
*
* @package part of A11yc
Method check
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'tell_user_file_type', self::$unspec, 1);
$str = Element\Get::ignoredHtml($url);
$ms = Element\Get::elementsByRe($str, 'ignores', 'anchors_and_values');
Method pages
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function pages($pages_old_tbl, $checks_old_tbl)
{
// migrate pages
self::migratePages($pages_old_tbl);
Function check
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function check($url)
{
Validate\Set::log($url, 'langless', self::$unspec, 5);
if (Validate::$is_partial === true) return;
Validate\Set::log($url, 'langless', self::$unspec, 1);
- 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 16 (exceeds 5 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);
- 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 recognitionCharset
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static function recognitionCharset($html)
{
$str = Element::ignoreElementsByStr($html);
// Do not use Element\Get::elementsByRe() because crashed character cause bad cache
preg_match_all("/\<([a-zA-Z1-6]+?) +?([^\>]*?)[\/]*?\>|\<([a-zA-Z1-6]+?)[ \/]*?\>/i", $str, $ms);
- 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 has a complexity of 9. Open
jQuery(function($){
- Read upRead up
- Exclude checks
Limit Cyclomatic Complexity (complexity)
Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.
function a(x) {
if (true) {
return x; // 1st path
} else if (false) {
return x+1; // 2nd path
} else {
return 4; // 3rd path
}
}
Rule Details
This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20
).
Examples of incorrect code for a maximum of 2:
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else if (false) {
return x+1;
} else {
return 4; // 3rd path
}
}
Examples of correct code for a maximum of 2:
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else {
return 4;
}
}
Options
Optionally, you may specify a max
object property:
"complexity": ["error", 2]
is equivalent to
"complexity": ["error", { "max": 2 }]
Deprecated: the object property maximum
is deprecated. Please use the property max
instead.
When Not To Use It
If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.
Further Reading
Related Rules
- [max-depth](max-depth.md)
- [max-len](max-len.md)
- [max-nested-callbacks](max-nested-callbacks.md)
- [max-params](max-params.md)
- [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/
Consider simplifying this complex logical expression. Open
if (
($list == 'all' && $page['trash'] == 0) ||
($list == 'yet' && $page['trash'] == 0 && $page['done'] == 0) ||
($list == 'done' && $page['trash'] == 0 && $page['done'] == 1) ||
($list == 'trash' && $page['trash'] == 1)
Method addPages
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addPages($is_force = false, $pages = array())
{
$pages = $pages ?: explode("\n", trim(Input::post('pages')));
// add without check
Function countTags
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function countTags($tags, $ignores)
{
$tags = is_null($tags) ? array() : $tags;
$opens = 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 yml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function yml()
{
include A11YC_LIB_PATH.'/spyc/Spyc.php';
if ( ! class_exists('Spyc')) Util::error('Spyc is not found');
$chekcs_text = file_get_contents(__DIR__.'/resources/old_checks.yml');
- 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 divideEachProperties
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function divideEachProperties($each_properties)
{
$props = array();
foreach ($each_properties as $prop_and_val)
{
- 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"