Showing 1,811 of 1,811 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (node.firstElementChild) {
node.dataset.hasChildren = 'true';
node.firstElementChild.innerHTML =
ZERO_WIDTH_SPACE +
node.firstElementChild.innerHTML +
- 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 50.
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 neighbors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dir: 'left' | 'right',
idx: number,
val: Value,
type: string,
located: Format[] = [],
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
icon: 'editor-ul',
title: __(
'Convert to unordered list',
'academic-bloggers-toolkit',
- 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 47.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
icon: 'editor-ol',
title: __(
'Convert to ordered list',
'academic-bloggers-toolkit',
- 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 47.
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
Expected 0 spaces between opening bracket and type hint "array"; 1 found Open
function add_options_link( array $links ): array {
- Exclude checks
Function ReferenceFormManual
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function ReferenceFormManual(props: Props) {
const [errorMessage, setErrorMessage] = useState('');
const [data, setData] = useState<CSL.Data>({
id: '',
type: 'webpage',
- 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
Expected 0 spaces before closing bracket; 1 found Open
if ( version_compare( ABT_VERSION, $options['VERSION'] ?? '0', '>' ) ) {
- Exclude checks
Function parseCSL
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function parseCSL(
filepath: string,
isIndependent: boolean,
): Promise<Style[]> {
const xml = await readfile(filepath, { encoding: 'utf-8' });
- 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 StyleForm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function StyleForm() {
const [style, setStyle] = useState(SAVED_STYLE);
const [errorMessage, setErrorMessage] = useState('');
return (
- 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
Expected 0 spaces between opening bracket and type hint "array"; 1 found Open
function add_donate_link( array $links, string $file ): array {
- Exclude checks
Expected 0 spaces between argument "$links" and closing bracket; 1 found Open
function add_options_link( array $links ): array {
- Exclude checks
Function inject_author_meta
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function inject_author_meta() {
global $post;
if ( ! $post || ! is_singular() ) {
return;
}
- 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 updateEditorCitations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function* updateEditorCitations(citations: Processor.CitationMeta[]) {
const doc = getEditorDOM();
for (const { html, id, sortedItems } of citations) {
const node = doc.querySelector<HTMLElement>(
createSelector(
- 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
Expected 0 spaces between argument "$file" and closing bracket; 1 found Open
function add_donate_link( array $links, string $file ): array {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( plugin_basename( __FILE__ ) === $file ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( is_admin() ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
foreach ( $legacy_meta->CSL as $id => $data ) { // phpcs:ignore
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( ! array_key_exists( '_abt_state', $meta ) || ! has_blocks( $post_id ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( array_key_exists( '_abt-reflist-state', $meta ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( $issued ) {
- Exclude checks