Showing 91 of 2,952 total issues
Assignment Branch Condition size for calculeIndiceHaut is too high. [17.75/15] Open
def calculeIndiceHaut()
nbCaseNoirConsecutif = 0 #variable qui permet de gerer les cases noir consecutifs
y=0
while y < @matriceComparaison.length #------------------------------------on parcours chaque colonne
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [12/10] Open
def sauver()
if(self.new_record?)
self.matriceComparaisonBD = Marshal.dump(@matriceComparaison)
self.indicesHautBD = Marshal.dump(@indicesHaut)
self.indicesCoteBD = Marshal.dump(@indicesCote)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def initialize()
@kRender = Render::Game.new
@kRender.game_scenes.add_observer(self) #Pattern Observable
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def initializeMainMenu()
@kMainMenu.supprimeTout
# Image de fond
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [11/10] Open
def actionOnChoice(unTypeEvenement, unComposantCible, unTexteCible = nil)
if unComposantCible == nil && unTexteCible != nil
@niveauCurseur = unTexteCible.to_s.to_i
nouveauLibell = @kRender.game_scenes.getVertexIDFromName("niveau-cible")
nouveauLibell.contenu = @niveauCurseur.to_s
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for actionOnChoice is too high. [8/7] Open
def actionOnChoice(unTypeEvenement, unComposantCible, unTexteCible = nil)
if unComposantCible == nil && unTexteCible != nil
@niveauCurseur = unTexteCible.to_s.to_i
nouveauLibell = @kRender.game_scenes.getVertexIDFromName("niveau-cible")
nouveauLibell.contenu = @niveauCurseur.to_s
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Cyclomatic complexity for actionOnChoice is too high. [7/6] Open
def actionOnChoice(unTypeEvenement, unComposantCible, unTexteCible = nil)
if unComposantCible == nil && unTexteCible != nil
@niveauCurseur = unTexteCible.to_s.to_i
nouveauLibell = @kRender.game_scenes.getVertexIDFromName("niveau-cible")
nouveauLibell.contenu = @niveauCurseur.to_s
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [11/10] Open
def prepareLevelSelection
# Image de fond
background = Image.creer("Background", "ressources/images/GUI/Prototypes/background-6.png", 0, 0, 0)
# Information sur version
libell_alpha = Text.creer("beta-1", "beta-preview 1", 15, 100, 120, 1)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for setup is too high. [8/7] Open
def setup
@scene_loops_per_second = 24
@@vertex = nil
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Perceived complexity for setAnimations is too high. [8/7] Open
def setAnimations
#Boucle de rafraichissement
always do
@@contexte.listeComposant.each do |composant|
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method has too many lines. [11/10] Open
def setAnimations
#Boucle de rafraichissement
always do
@@contexte.listeComposant.each do |composant|
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for setAnimations is too high. [7/6] Open
def setAnimations
#Boucle de rafraichissement
always do
@@contexte.listeComposant.each do |composant|
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for setup is too high. [7/6] Open
def setup
@scene_loops_per_second = 24
@@vertex = nil
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [11/10] Open
def demanderAide()
while y < @matriceComparaison.length
x=0
while x < @matriceComparaison.length
if(@matriceComparaison[x][y] == 1 and @matriceDeJeu[x][y] == 0 ) then
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for update is too high. [16.49/15] Open
def update(unTypeEvenement, unComposantCible, unTexteEntree=nil)
#puts "Attention: Evenement Trigger #{unComposantCible.designation} sur typeEvenement = #{unTypeEvenement} avec contexte = #{@kRender.getContext.designation}"
#On redirige vers la méthode concernée
if @kRender.getContext.designation == "Menu principal"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method setAnimations
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def setAnimations
#Boucle de rafraichissement
always do
@@contexte.listeComposant.each do |composant|
- 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
Assignment Branch Condition size for eql is too high. [15.52/15] Open
def eql(pro)
return (pro.id == self.id and pro.pseudo == self.pseudo and pro.nom == self.nom and pro.prenom == self.prenom and pro.argent == self.argent )
end
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for estNoir? is too high. [15.26/15] Open
def estNoir?(x,y)
x=x-1 #on decrémente les indices de -1 parce que le tableau commence à l'indice 0
y=y-1
if x > matriceComparaison.length
raise RangeError.new("coordonée x en dehors de la matrice ")
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for demanderAide is too high. [15.39/15] Open
def demanderAide()
while y < @matriceComparaison.length
x=0
while x < @matriceComparaison.length
if(@matriceComparaison[x][y] == 1 and @matriceDeJeu[x][y] == 0 ) then
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for eql is too high. [15.52/15] Open
def eql(g)
return (g.id == self.id and
g.matriceComparaison == self.matriceComparaison and
g.indicesHaut == self.indicesHaut and
g.indicesCote == self.indicesCote and
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric