Nick9500/ministocks

View on GitHub

Showing 67 of 108 total issues

Method getSuggestions has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     static List<Map<String, String>> getSuggestions(String query) {
        final Pattern STOCK_REGEX = Pattern.compile("^" + query + "[A-Z0-9]*", Pattern.CASE_INSENSITIVE);

        List<Map<String, String>> suggestions = new ArrayList<>();
        String cryptoResponse, stockResponse;
Severity: Major
Found in src/main/java/nitezh/ministock/StockSuggestions.java - About 2 hrs to fix

    Method getSuggestions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

         static List<Map<String, String>> getSuggestions(String query) {
            final Pattern STOCK_REGEX = Pattern.compile("^" + query + "[A-Z0-9]*", Pattern.CASE_INSENSITIVE);
    
            List<Map<String, String>> suggestions = new ArrayList<>();
            String cryptoResponse, stockResponse;
    Severity: Minor
    Found in src/main/java/nitezh/ministock/StockSuggestions.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 doInBackground has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        protected Void doInBackground(Void... voids) {
            //Data Storage Directory
            String path = Environment.getExternalStorageDirectory() + File.separator + "DataFolder";
            File folder = new File(path);
    Severity: Minor
    Found in src/main/java/nitezh/ministock/MimeSendTask.java - About 1 hr to fix

      Method alertWithCallback has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static void alertWithCallback(
                  Context context,
                  String title,
                  String body,
                  String positiveButtonText,
      Severity: Minor
      Found in src/main/java/nitezh/ministock/DialogTools.java - About 1 hr to fix

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

            public static void inputWithCallback(Context context, String title, String body,
                                                 String positiveButtonText, String negativeButtonText,
                                                 String defaultInputText,
                                                 final InputAlertCallable callable) {
                // Create dialog
        Severity: Minor
        Found in src/main/java/nitezh/ministock/DialogTools.java - About 1 hr to fix

          Method onReceive has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void onReceive(@SuppressWarnings("NullableProblems") Context context,
                                    @SuppressWarnings("NullableProblems") Intent intent) {
                  String action = intent.getAction();
                  if (action != null) {

            Method onReceive has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public void onReceive(@SuppressWarnings("NullableProblems") Context context,
                                      @SuppressWarnings("NullableProblems") Intent intent) {
                    String action = intent.getAction();
                    if (action != null) {

            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 refreshView has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void refreshView() {
                    setContentView(R.layout.portfolio);
            
                    List<Map<String, String>> listViewData = this.portfolioRepository.getDisplayInfo();
                    SimpleAdapter adapter = new SimpleAdapter(this, listViewData, R.layout.portfolio_list_item,
            Severity: Minor
            Found in src/main/java/nitezh/ministock/activities/PortfolioActivity.java - About 1 hr to fix

              Method getStocks has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  HashMap<String, PortfolioStock> getStocks() {
                      if (!isDirtyPortfolioStockMap()) {
                          return mPortfolioStocks;
                      }
                      mPortfolioStocks.clear();
              Severity: Minor
              Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 1 hr to fix

                Method loadQuotes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private HashMap<String, StockQuote> loadQuotes() {
                        if (mCachedQuotes != null && !mCachedQuotes.isEmpty()) {
                            return mCachedQuotes;
                        }
                
                
                Severity: Minor
                Found in src/main/java/nitezh/ministock/domain/StockQuoteRepository.java - About 1 hr to fix

                  Method getStocks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      HashMap<String, PortfolioStock> getStocks() {
                          if (!isDirtyPortfolioStockMap()) {
                              return mPortfolioStocks;
                          }
                          mPortfolioStocks.clear();
                  Severity: Minor
                  Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.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 doScheduledUpdates has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static void doScheduledUpdates(Context context) {
                          boolean doUpdates = true;
                          Storage prefs = PreferenceStorage.getInstance(context);
                  
                          // Only update after start time

                  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 getBlankRemoteViews has 32 lines of code (exceeds 25 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 1 hr to fix

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

                        @Override
                        public void setWidgetPreferencesFromJson(JSONObject jsonPrefs) {
                            String key;
                            for (Iterator preferenceKey = jsonPrefs.keys(); preferenceKey.hasNext(); ) {
                                key = (String) preferenceKey.next();
                    Severity: Minor
                    Found in src/main/java/nitezh/ministock/domain/AndroidWidget.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 getSuggestions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public Cursor getSuggestions(String query) {
                            query = query == null ? "" : query.toLowerCase().trim();
                            List<Map<String, String>> suggestions = StockSuggestions.getSuggestions(query);
                    
                            // Check whether an exact match is found in the symbol
                    Severity: Minor
                    Found in src/main/java/nitezh/ministock/SymbolProvider.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 onResume has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        protected void onResume() {
                            super.onResume();
                    
                    
                    
                    Severity: Minor
                    Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 1 hr to fix

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

                          public static void choiceWithCallback(
                                  Context context,
                                  String title,
                                  String negativeButtonText,
                                  final CharSequence[] choices,
                      Severity: Minor
                      Found in src/main/java/nitezh/ministock/DialogTools.java - About 1 hr to fix

                        Method getSuggestions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public Cursor getSuggestions(String query) {
                                query = query == null ? "" : query.toLowerCase().trim();
                                List<Map<String, String>> suggestions = StockSuggestions.getSuggestions(query);
                        
                                // Check whether an exact match is found in the symbol
                        Severity: Minor
                        Found in src/main/java/nitezh/ministock/SymbolProvider.java - About 1 hr to fix

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

                              @Override
                              public Set<String> getWidgetsStockSymbols() {
                                  Storage widgetPreferences;
                                  Set<String> widgetStockSymbols = new HashSet<>();
                                  for (int appWidgetId : this.getIds()) {
                          Severity: Minor
                          Found in src/main/java/nitezh/ministock/domain/AndroidWidgetRepository.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 getQuotes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public HashMap<String, StockQuote> getQuotes(Cache cache, List<String> symbols) {
                                  HashMap<String, StockQuote> quotes = new HashMap<>();
                                  HashMap<String, String> fxChanges = this.fxChangeRepository.getChanges(cache, symbols);
                                  JSONArray jsonArray;
                                  JSONObject quoteJson;
                            Severity
                            Category
                            Status
                            Source
                            Language