batebates/sudoku

View on GitHub

Showing 57 of 67 total issues

Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize()
        SudokuAPI.API.add_observer(self);
        header = Gtk::HeaderBar.new();
        header.set_title(Window.window.title);
        header.set_subtitle("Demo");
Severity: Minor
Found in src/view/Header.rb - About 1 hr to fix

Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(difficulty, grid_string = "")
        puts "Generating new sudoku..."
        # Either take a pre-created puzzle, or create a new one programmatically

        random = Random.new
Severity: Minor
Found in src/model/Generator.rb - About 1 hr to fix

Method buildLeftContainer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def buildLeftContainer()
        # Split container into 2 parts : Top (Grid) & Bottom (Assistant)
        leftContainer = Gtk::Grid.new();
        GridView.init(leftContainer);

Severity: Minor
Found in src/view/Window.rb - About 1 hr to fix

Method saveSudoku has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def saveSudoku(fileName)
        saveFile = File.new("save_files/"+fileName, "w")

        if(!saveFile.closed?)
            print "Fichier de sauvegarde ouvert\n"
Severity: Minor
Found in src/controller/SudokuAPI.rb - About 1 hr to fix

Method loadSudoku has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def loadSudoku(fileName)
        filePath = "save_files/#{fileName}"
        if(File.file?(filePath))
            loadFile = File.new(filePath, "r")

Severity: Minor
Found in src/controller/SudokuAPI.rb - About 1 hr to fix

Method saveSudoku has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def saveSudoku(fileName)
        saveFile = File.new("save_files/"+fileName, "w")

        if(!saveFile.closed?)
            print "Fichier de sauvegarde ouvert\n"
Severity: Minor
Found in src/controller/SudokuAPI.rb - 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

Method onSudokuMethod has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def onSudokuMethod


        if(@step == nil)
            statutMethod(true)
Severity: Minor
Found in src/controller/MethodUniqueCandidate.rb - 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

Method traitementOnRow has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def traitementOnRow(region,sens,ligne)
        if(ligne==1)
            tab = squareNumber(region,0,sens) #retourne case d'une ligne ou colonne
            tab2 = squareNumber(region,1,sens) #retourne case d'une ligne ou colonne
            tab3 = squareNumber(region,2,sens) #retourne case d'une ligne ou colonne
Severity: Minor
Found in src/controller/MethodTwinsAndTriplets.rb - 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

Method demoMethod has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def demoMethod
        if(@step == nil)
            statutMethod(true)

            @step = 0
Severity: Minor
Found in src/controller/MethodUniqueCandidate.rb - About 1 hr to fix

Method traitementOnRow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def traitementOnRow(region,sens,ligne)
        if(ligne==1)
            tab = squareNumber(region,0,sens) #retourne case d'une ligne ou colonne
            tab2 = squareNumber(region,1,sens) #retourne case d'une ligne ou colonne
            tab3 = squareNumber(region,2,sens) #retourne case d'une ligne ou colonne
Severity: Minor
Found in src/controller/MethodTwinsAndTriplets.rb - About 1 hr to fix

Method demoMethod has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def demoMethod
        @type = "demoMethod"
      case @step
          when nil
                @step = 0
Severity: Minor
Found in src/controller/MethodUnicite.rb - About 1 hr to fix

Method test_sudokuAPI has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     def test_sudokuAPI
         grid = Sudoku.create("000000083004800070000000250500090060310700805068010007400901000890563000000407509")
         s = SudokuAPI.API();
        SudokuAPI.API.setSudoku(grid)

Severity: Minor
Found in src/Test.rb - About 1 hr to fix

Method show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def OverlayManager.show()
        @@open = true;
        square = SquareView.selectedSquareView();
        caze = SquareView.selectedSquareView().caze;
        OverlayManager.clear();
Severity: Minor
Found in src/view/OverlayManager.rb - About 1 hr to fix

Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(overlay)
        @@buttons = Array.new();
        @@overlayPanel = Gtk::Fixed.new();
        sudokuChoiceGrid = Gtk::Grid.new();
        sudokuChoiceGrid.name = "overlay-grid";
Severity: Minor
Found in src/view/OverlayManager.rb - 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

Method valid? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def valid?()
        return false unless @grid

        return false unless @grid.length == 81

Severity: Minor
Found in src/model/Generator.rb - 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

Method setLineStyle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def setLineStyle(ctx, x, y, vertical)
        isBigLine = vertical ? (x % 3 == 0) : (y % 3 == 0);
        isExternalLine = vertical ? (x == 0 || x == 9) : (y == 0 || y == 9);
        color = 0.0;
        ctx.set_line_width(isBigLine ? (isExternalLine ? 4 : 2) : 0.5);
Severity: Minor
Found in src/view/SquareView.rb - 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

Method initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize()
        @confEntry = Config.entries
        @entryNewList = Array.new

        @avatarList = Dir[AssetManager.assetsDir() + "/avatar_small/*.png"]
Severity: Minor
Found in src/view/ConfigDialog.rb - About 1 hr to fix

Method initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize()
        puts("Creating window...");
        SudokuAPI.API.add_observer(self);

        @@window = Gtk::Window.new("Sudoku");
Severity: Minor
Found in src/view/Window.rb - About 1 hr to fix

Method initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize valeurs
        
        super() 

        ## TODO: Lire largeur et hauteur dans un fichier de config
Severity: Minor
Found in widgetTestGTK3.rb - About 1 hr to fix

Method squareNumber has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def squareNumber(region,number,sens)
        tab_region = SudokuAPI.API.squareN(region)
        i = 0
        sous_region=Array.new()
        tab_region.each do |elt|
Severity: Minor
Found in src/controller/MethodTwinsAndTriplets.rb - About 55 mins 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