CharafeddineMechalikh/PureEdgeSim

View on GitHub

Showing 55 of 95 total issues

File SimLog.java has 548 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 *     PureEdgeSim:  A Simulation Framework for Performance Evaluation of Cloud, Edge and Mist Computing Environments 
 *
 *     This file is part of PureEdgeSim Project.
 *
Severity: Major
Found in PureEdgeSim/com/mechalikh/pureedgesim/simulationmanager/SimLog.java - About 1 day to fix

    ComputingNodeNull has 51 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class ComputingNodeNull implements ComputingNode {
    
        /**
         * 
         * Represents a null computing node, used as a placeholder when a computing node

      ComputingNode has 50 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public interface ComputingNode {
          
          /**
           * An enum representing the orientation of a network link.
           * 

        Task has 42 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public interface Task extends QueueElement {
        
            /**
             * Enumeration for failure reasons of a Task.
             */
        Severity: Minor
        Found in PureEdgeSim/com/mechalikh/pureedgesim/taskgenerator/Task.java - About 5 hrs to fix

          Method processEvent has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void processEvent(Event ev) {
                  Task task = (Task) ev.getData();
                  switch (ev.getTag()) {
                  case NEXT_BATCH:

          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

          SimLog has 39 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class SimLog {
              public static final int NO_TIME = 0;
              public static final int SAME_LINE = 1;
              public static final int DEFAULT = 2;
              protected ArrayList<String> resultsList = new ArrayList<String>();
          Severity: Minor
          Found in PureEdgeSim/com/mechalikh/pureedgesim/simulationmanager/SimLog.java - About 5 hrs to fix

            Method printPowerConsumptionResults has 122 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void printPowerConsumptionResults(List<Task> finishedTasks) {
                    int deadEdgeDevicesCount = 0;
                    double energyConsumption = 0;
                    double cloudEnConsumption = 0;
                    double mistEnConsumption = 0;
            Severity: Major
            Found in PureEdgeSim/com/mechalikh/pureedgesim/simulationmanager/SimLog.java - About 4 hrs to fix

              Method checkSimulationProperties has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected boolean checkSimulationProperties() {
                      SimLog.println("%s - Checking simulation properties file...",getClass().getSimpleName());
                      boolean result = false;
                      try (InputStream input = new FileInputStream(file)) {
              
              

                DefaultComputingNode has 29 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public class DefaultComputingNode extends LocationAwareNode {
                    protected int applicationType;
                    protected boolean isSensor = false;
                    protected double availableStorage = 0; // in Megabytes
                    protected double storage = 0; // in Megabytes

                  Method createComputingNode has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected ComputingNode createComputingNode(Element datacenterElement, SimulationParameters.TYPES type)
                              throws NoSuchAlgorithmException, NoSuchMethodException, SecurityException, InstantiationException,
                              IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                          // SecureRandom is preferred to generate random values.
                          Random random = SecureRandom.getInstanceStrong();

                    Method processEvent has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public void processEvent(Event ev) {
                            Task task = (Task) ev.getData();
                            switch (ev.getTag()) {
                            case NEXT_BATCH:

                      DefaultTask has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      public class DefaultTask extends TaskAbstract {
                      
                          /**
                           * The time required for offloading the task in seconds.
                           */
                      Severity: Minor
                      Found in PureEdgeSim/com/mechalikh/pureedgesim/taskgenerator/DefaultTask.java - About 2 hrs to fix

                        MobilityModel has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        public abstract class MobilityModel {
                        
                            protected Location currentLocation;
                            protected boolean isMobile = false;
                            protected double minPauseDuration;

                          Method printTasksRelatedResults has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public void printTasksRelatedResults() {
                                  print(getClass().getSimpleName() + " - Printing iteration output...");
                                  print("------------------------------------------------------- OUTPUT -------------------------------------------------------");
                                  print("");
                                  print("Tasks not sent because device died (low energy)                         :"
                          Severity: Major
                          Found in PureEdgeSim/com/mechalikh/pureedgesim/simulationmanager/SimLog.java - About 2 hrs to fix

                            Method getOrchestrator has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                                @Override
                                public ComputingNode getOrchestrator() {
                                    if (orchestrator == ComputingNode.NULL && SimulationParameters.enableOrchestrators) {
                                        if ("".equals(SimulationParameters.deployOrchestrators)
                                                || ("CLOUD".equals(SimulationParameters.deployOrchestrators))) {

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

                                public boolean taskFailed(Task task, int phase) {
                                    // task not generated because device died
                                    if (task.getEdgeDevice().isDead()) {
                                        simLog.incrementFailedBeacauseDeviceDead(task);
                                        task.setFailureReason(Task.FailureReason.FAILED_BECAUSE_DEVICE_DEAD);

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

                                public void printPowerConsumptionResults(List<Task> finishedTasks) {
                                    int deadEdgeDevicesCount = 0;
                                    double energyConsumption = 0;
                                    double cloudEnConsumption = 0;
                                    double mistEnConsumption = 0;
                            Severity: Minor
                            Found in PureEdgeSim/com/mechalikh/pureedgesim/simulationmanager/SimLog.java - 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 checkAppFile has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected boolean checkAppFile() {
                                    String condition = "> 0. Check the \"";
                                    String application = "\" application in \"";
                                    SimLog.println("%s - Checking applications file.",this.getClass().getSimpleName());
                                    SimulationParameters.applicationList = new ArrayList<>();

                              Method taskFailed has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public boolean taskFailed(Task task, int phase) {
                                      // task not generated because device died
                                      if (task.getEdgeDevice().isDead()) {
                                          simLog.incrementFailedBeacauseDeviceDead(task);
                                          task.setFailureReason(Task.FailureReason.FAILED_BECAUSE_DEVICE_DEAD);

                                Method send has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public void send(ComputingNode from, ComputingNode to, Task task, double fileSize, TransferProgress.Type type) {
                                        List<ComputingNode> vertexList = new ArrayList<>(5);
                                        List<NetworkLink> edgeList = new ArrayList<>(5);
                                
                                        // If both are edge devices (one hop far from each other), send directly.
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language