Nick9500/ministocks

View on GitHub

Showing 67 of 108 total issues

File PreferencesActivity.java has 764 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 The MIT License

 Copyright (c) 2013 Nitesh Patel http://niteshpatel.github.io/ministocks

Severity: Major
Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 1 day to fix

    PreferencesActivity has 70 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class PreferencesActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
    
        // Constants
        private static final int STRING_TYPE = 0;
        private static final int LIST_TYPE = 1;
    Severity: Major
    Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 1 day to fix

      Method onCreate has 245 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              addPreferencesFromResource(R.xml.preferences);
      
      
      Severity: Major
      Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 1 day to fix

        File WidgetView.java has 518 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         The MIT License
         
         Copyright (c) 2013 Nitesh Patel http://niteshpatel.github.io/ministocks
         
        Severity: Major
        Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - About 1 day to fix

          AndroidWidget has 38 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class AndroidWidget implements Widget {
          
              private final Storage storage;
              private final Context context;
              private final int id;
          Severity: Minor
          Found in src/main/java/nitezh/ministock/domain/AndroidWidget.java - About 5 hrs to fix

            Widget has 37 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public interface Widget {
                Storage getStorage();
            
                void setWidgetPreferencesFromJson(JSONObject jsonPrefs);
            
            
            Severity: Minor
            Found in src/main/java/nitezh/ministock/domain/Widget.java - About 4 hrs to fix

              Method doInBackground has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  protected List<String> doInBackground(String... strings) {
                      List<String> closingValuesWeekly = new ArrayList<>();
              
                      try {
              Severity: Minor
              Found in src/main/java/nitezh/ministock/activities/GlobalWidgetData.java - About 4 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

              Method showPortfolioItemEdit has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void showPortfolioItemEdit(AdapterView<?> a, int position) {
                      // Create the portfolio item edit dialog
                      final Dialog portfolioItemEdit = new Dialog(this);
                      portfolioItemEdit.setContentView(R.layout.portfolio_item);
              
              
              Severity: Major
              Found in src/main/java/nitezh/ministock/activities/PortfolioActivity.java - About 3 hrs to fix

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

                public class WidgetView {
                
                    private final RemoteViews remoteViews;
                    private final Widget widget;
                    private final boolean hasPortfolioData;
                Severity: Minor
                Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - About 3 hrs to fix

                  Method doInBackground has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      protected List<String> doInBackground(String... strings) {
                          List<String> closingValuesWeekly = new ArrayList<>();
                  
                          try {
                  Severity: Major
                  Found in src/main/java/nitezh/ministock/activities/GlobalWidgetData.java - About 3 hrs to fix

                    File PortfolioStockRepository.java has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*
                     The MIT License
                    
                     Copyright (c) 2013 Nitesh Patel http://niteshpatel.github.io/ministocks
                    
                    
                    Severity: Minor
                    Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 3 hrs to fix

                      PortfolioStockRepository has 26 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      public class PortfolioStockRepository {
                          public static final String PORTFOLIO_JSON = "portfolioJson";
                          public static final String WIDGET_JSON = "widgetJson";
                          private static final HashMap<String, PortfolioStock> mPortfolioStocks = new HashMap<>();
                          private static boolean mDirtyPortfolioStockMap = true;
                      Severity: Minor
                      Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 3 hrs to fix

                        Method getRowInfo has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public WidgetRow getRowInfo(String symbol, ViewType widgetView) {
                                WidgetRow widgetRow = new WidgetRow(this.widget);
                                StockQuote quote = this.quotes.get(symbol);
                        
                                widgetRow.setSymbol(symbol);
                        Severity: Major
                        Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - About 2 hrs to fix

                          Method onResume has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Override
                              public void onResume() {
                                  super.onResume();
                                  int interval = GlobalWidgetData.getInterval();
                                  int position = getIntent().getIntExtra(WidgetProviderBase.ROW_POSITION, 0);
                          Severity: Major
                          Found in src/main/java/nitezh/ministock/activities/ChartActivity.java - About 2 hrs to fix

                            Method getLabel has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private String getLabel(int widgetDisplay) {
                                    // Set the widget view text in the footer
                                    String label = "";
                                    if (widget.isNarrow()) {
                                        switch (ViewType.values()[widgetDisplay]) {
                            Severity: Major
                            Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - About 2 hrs to fix

                              Method updateSummaries has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private void updateSummaries(SharedPreferences sharedPreferences, String key) {
                                      Preference preference = findPreference(key);
                              
                                      if (preference != null) {
                              
                              
                              Severity: Minor
                              Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - 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

                              Method sendEmailToUser has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private void sendEmailToUser() {
                              
                                      // Set up the input
                                      final EditText input = new EditText(this);
                                      input.setId(R.id.emailFieldID);
                              Severity: Major
                              Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 2 hrs to fix

                                Method showPortfolioItemEdit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private void showPortfolioItemEdit(AdapterView<?> a, int position) {
                                        // Create the portfolio item edit dialog
                                        final Dialog portfolioItemEdit = new Dialog(this);
                                        portfolioItemEdit.setContentView(R.layout.portfolio_item);
                                
                                
                                Severity: Minor
                                Found in src/main/java/nitezh/ministock/activities/PortfolioActivity.java - 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

                                Method updateSummaries has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private void updateSummaries(SharedPreferences sharedPreferences, String key) {
                                        Preference preference = findPreference(key);
                                
                                        if (preference != null) {
                                
                                
                                Severity: Major
                                Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 2 hrs to fix

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

                                      private RemoteViews getBlankRemoteViews(Widget widget, String packageName) {
                                          String backgroundStyle = widget.getBackgroundStyle();
                                          boolean useLargeFont = widget.useLargeFont();
                                  
                                          RemoteViews views;
                                  Severity: Minor
                                  Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language