bootstrapworld/codemirror-blocks

View on GitHub

Showing 132 of 132 total issues

Function parse has a Cognitive Complexity of 245 (exceeds 5 allowed). Consider refactoring.
Open

export function parse(code) {
  function fallback(sexp) {
    var elts =
      sexp instanceof Array ? parseStar(sexp) : [parseExprSingleton(sexp)];
    var guess = new structures.unsupportedExpr(elts, "Parse error");
Severity: Minor
Found in packages/wescheme-blocks/src/WeschemeParser.js - About 5 days to fix

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 parse has a Cognitive Complexity of 242 (exceeds 5 allowed). Consider refactoring.
Open

  parse(code) {
    function fallback(sexp) {
      var elts =
        sexp instanceof Array ? parseStar(sexp) : [parseExprSingleton(sexp)];
      var guess = new structures.unsupportedExpr(elts, "Parse error");
Severity: Minor
Found in packages/codemirror-blocks/src/languages/wescheme/WeschemeParser.js - About 4 days to fix

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 parseNode has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

export function parseNode(node: structures.Program, i = 0) {
  function locationFromNode(node: structures.Program) {
    const from = {
      line: node.location.startRow - 1,
      ch: node.location.startCol,
Severity: Minor
Found in packages/wescheme-blocks/src/parseNode.ts - About 1 day to fix

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 parseNode has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

function parseNode(node, i) {
  function locationFromNode(node) {
    var from = {
      line: node.location.startRow - 1,
      ch: node.location.startCol,
Severity: Minor
Found in packages/codemirror-blocks/src/languages/wescheme/WeschemeParser.js - About 1 day to fix

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 parse has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

function parse(input) {
  var fromLocation, toLocation;
  var PRECEDENCE = {
    "=": 1,
    "||": 2,
Severity: Minor
Found in packages/codemirror-blocks/src/languages/lambda/parser.js - About 1 day to fix

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 Node has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

const Node = ({ expandable = true, ...props }: Props) => {
  const isCollapsed = useSelector((state: RootState) =>
    selectors.isCollapsed(state, props.node)
  );
  const isSelected = useSelector((state: RootState) =>
Severity: Minor
Found in packages/codemirror-blocks/src/components/Node.tsx - About 1 day to fix

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 BlockEditor has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

const BlockEditor = ({ options = {}, ...props }: BlockEditorProps) => {
  const { language } = props;
  const dispatch: AppDispatch = useDispatch();
  const ast = useSelector(selectors.getAST);
  const quarantine = useSelector(selectors.getQuarantine);
Severity: Minor
Found in packages/codemirror-blocks/src/ui/BlockEditor.tsx - About 7 hrs to fix

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 buildBlockModeAPI has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

const buildBlockModeAPI = (
  codemirror: CodeMirror.Editor,
  store: AppStore,
  language: Language
): BlockModeAPI => {
Severity: Minor
Found in packages/codemirror-blocks/src/CodeMirror-api.tsx - About 6 hrs to fix

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 tokenStream has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

function tokenStream(input) {
  var current = null;
  var fromLocation = input.inputPos(),
    toLocation = input.inputPos();
  var keywords = " let if then else lambda λ true false js:raw ";
Severity: Minor
Found in packages/codemirror-blocks/src/languages/lambda/parser.js - About 5 hrs to fix

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 getLocation has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

const getLocation = ({
  ast,
  id,
  context,
}: {
Severity: Minor
Found in packages/codemirror-blocks/src/components/DropTarget.tsx - About 3 hrs to fix

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 patchAst has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export default function patchAst(oldTree: ASTNode[], newTree: ASTNode[]) {
  function children(node: ASTNode | ASTNode[]): ASTNode[] {
    if (node instanceof ASTNode) {
      return [...node.children()];
    }
Severity: Minor
Found in packages/codemirror-blocks/src/edits/patchAst.ts - About 3 hrs to fix

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 search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  search: (cur, settings, editor, state, forward) => {
    const ast = selectors.getAST(state);
    const { collapsedList } = state;
    const collapsedNodeList = collapsedList.map(ast.getNodeById);

Severity: Minor
Found in packages/codemirror-blocks/src/ui/searchers/ByString.tsx - About 2 hrs to fix

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 getToken has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  getToken(): Token {
    const IDENTIFIER_RE = /[\w-+/*]/;
    if (this.charIndex >= this.code.length) {
      return new Token(
        { line: this.lineIndex, ch: this.colIndex },
Severity: Minor
Found in packages/codemirror-blocks/src/languages/example/ExampleParser.ts - About 2 hrs to fix

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 DragAndDropEditor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const DragAndDropEditor = (props: Props) => {
  const editorRef = useRef<CodeMirrorFacade>();
  const dispatch = useDispatch();
  const [_, connectDropTarget] = useDrop({
    accept: ItemTypes.NODE,
Severity: Minor
Found in packages/codemirror-blocks/src/ui/DragAndDropEditor.tsx - About 2 hrs to fix

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 findAdjacentDropTargetId has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function findAdjacentDropTargetId(
  ast: AST,
  child: ASTNode,
  onLeft: boolean
) {
Severity: Minor
Found in packages/codemirror-blocks/src/components/DropTarget.tsx - About 2 hrs to fix

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 pasteHandler has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  (env: Env, e: React.KeyboardEvent): AppThunk =>
  (dispatch, getState) => {
    if (!env.isNodeEnv) {
      return;
    }
Severity: Minor
Found in packages/codemirror-blocks/src/keymap.tsx - About 2 hrs to fix

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 constructor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(parent: ASTNode, child: ASTNode) {
    this.parent = parent;
    this.child = child;
    for (const spec of parent.spec.childSpecs) {
      if (spec instanceof List) {
Severity: Minor
Found in packages/codemirror-blocks/src/edits/fakeAstEdits.ts - About 1 hr to fix

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 groupEditsByAncestor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function groupEditsByAncestor(edits: AstEdit[]) {
  const editToEditGroup: Map<AstEdit, EditGroup> = new Map();
  // Group n AstEdits into m EditGroups (m <= n)
  for (const edit of edits) {
    // Start with the default assumption that this parent is independent.
Severity: Minor
Found in packages/codemirror-blocks/src/edits/performEdits.ts - About 1 hr to fix

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 PrimitiveList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

>((props: PrimitiveListProps, ref) => {
  const {
    primitives = [],
    selected,
    setSelectedPrimitive,
Severity: Minor
Found in packages/codemirror-blocks/src/ui/PrimitiveList.tsx - About 1 hr to fix

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 Toggle Selection has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  "Toggle Selection": (env, e) => (dispatch, getState) => {
    if (!env.isNodeEnv) {
      return;
    }
    e.preventDefault();
Severity: Minor
Found in packages/codemirror-blocks/src/keymap.tsx - About 1 hr to fix

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

Severity
Category
Status
Source
Language