Showing 26 of 26 total issues
File gridsome.server.ts
has 708 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
InvalidArgumentError,
InvalidCharacterError,
MissingKeyError,
} from "./exception";
Similar blocks of code found in 2 locations. Consider refactoring. Open
private _checkContentSecurityPolicyOption(): void {
const optionName = "contentSecurityPolicy";
this._throwIfMissingOption(optionName);
this._throwIfOptionNotObject(optionName);
- 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 165.
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
private _checkFeaturePolicyOption(): void {
const optionName = "featurePolicy";
this._throwIfMissingOption(optionName);
this._throwIfOptionNotObject(optionName);
- 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 165.
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
GridsomePluginHtaccess
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class GridsomePluginHtaccess {
protected _options: IOptions;
protected _htaccessLines: Array<string>;
protected _htaccessContent: string;
Similar blocks of code found in 2 locations. Consider refactoring. Open
private _insertTextCompression(): void {
if (this._options.textCompression.length > 0) {
this._htaccessLines.push("# Enable text compression");
this._htaccessLines.push("<IfModule mod_deflate.c>");
- 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 140.
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
private _insertBlockedIp(): void {
if (this._options.blockedIp.length > 0) {
this._htaccessLines.push("# Block IP addresses");
this._htaccessLines.push("order allow,deny");
- 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 140.
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 _checkFileExpirations
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private _checkFileExpirations(): void {
const optionName = "fileExpirations";
this._throwIfMissingOption(optionName);
this._throwIfOptionNotObject(optionName);
- 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 _checkRedirectionsOption
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private _checkRedirectionsOption(): void {
const optionName = "redirections";
this._throwIfMissingOption(optionName);
this._throwIfOptionNotArray(optionName);
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
private _insertDisableDirectoryIndex(): void {
if (this._options.disableDirectoryIndex) {
this._htaccessLines.push("# Disable directory index");
this._htaccessLines.push("Options All -Indexes");
this._htaccessLines.push("\n");
- 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 72.
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
private _insertDisableServerSignature(): void {
if (this._options.disableServerSignature) {
this._htaccessLines.push(
"# Prevent your server from sending the version of the server"
);
- 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 72.
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 _checkRedirectionsOption
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _checkRedirectionsOption(): void {
const optionName = "redirections";
this._throwIfMissingOption(optionName);
this._throwIfOptionNotArray(optionName);
Function _checkFileExpirations
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _checkFileExpirations(): void {
const optionName = "fileExpirations";
this._throwIfMissingOption(optionName);
this._throwIfOptionNotObject(optionName);
Function constructor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(api: IApi, options: IOptions) {
this._htaccessLines = [];
this._options = options;
this._htaccessContent = "";
Function _insertFileExpirations
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _insertFileExpirations(): void {
if (
"default" in this._options.fileExpirations &&
this._options.fileExpirations.default !== undefined &&
this._options.fileExpirations.default.length > 0
Function _insertContentSecurityPolicy
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _insertContentSecurityPolicy(): void {
if (Object.keys(this._options.contentSecurityPolicy).length > 0) {
const policies: Array<string> = [];
for (const policyName in this._options.contentSecurityPolicy) {
Function _checkPreventDdosAttacksOption
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _checkPreventDdosAttacksOption(): void {
if (
"preventDdosAttacks" in this._options &&
this._options.preventDdosAttacks !== undefined
) {
Function _insertNotCachedFiles
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _insertNotCachedFiles(): void {
if (this._options.notCachedFiles.length > 0) {
this._htaccessLines.push(
"# Prevent the following files to be cached by your users' browser"
);
Function _checkCustomContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _checkCustomContent(): void {
const optionName = "customContent";
if (
optionName in this._options &&
Function _checkCustomContent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private _checkCustomContent(): void {
const optionName = "customContent";
if (
optionName in this._options &&
- 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 _insertFileExpirations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private _insertFileExpirations(): void {
if (
"default" in this._options.fileExpirations &&
this._options.fileExpirations.default !== undefined &&
this._options.fileExpirations.default.length > 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"