Showing 29 of 110 total issues
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
width, height, previewWidth, hast, onFocus, cursorPosition,
} = this.state;
const { defaultValue } = this.props;
Function handleClientCursor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
handleClientCursor(msg) {
const client = this.otherClients.get(msg.id);
if (msg.type === 'update') {
if (!this.refEditor.current) return;
const cm = this.refEditor.current.editor;
- 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 findFlippablesInDirection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function findFlippablesInDirection(cells, x, y, color, directionX, directionY) {
for (let curX = x + directionX, curY = y + directionY; isValidPos(curX, curY); curX += directionX, curY += directionY) {
const cur = cells[curX][curY];
if (cur === StoneNone) return [];
if (cur === color) {
- 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 findFlippablesInDirection
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function findFlippablesInDirection(cells, x, y, color, directionX, directionY) {
Function convertToCustomHast
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static convertToCustomHast(hast) {
if (hast.type === 'text') return hast;
if (hast.tagName === 'pre') {
const codeNode = hast.children[0];
const htmlClasses = codeNode.properties.className;
- 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
Avoid too many return
statements within this function. Open
return 1;
Avoid too many return
statements within this function. Open
return 0;
Function handleAppEdit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleAppEdit(newText, appContext) {
const cm = this.refEditor.current.editor;
const startFencedStr = cm.getLine(appContext.position.start.line - 1);
const [backticks] = WikiParser.getExtraFencingChars(startFencedStr, newText);
if (backticks) {
- 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 deserialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static deserialize(str) {
try {
const obj = Yaml.load(str);
const model = new WeatherModel();
if (obj.country) model.country = obj.country;
- 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"