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;
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;
- 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
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);
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,
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
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) {
- 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
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,
Method getStocks
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
HashMap<String, PortfolioStock> getStocks() {
if (!isDirtyPortfolioStockMap()) {
return mPortfolioStocks;
}
mPortfolioStocks.clear();
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;
}
Method getStocks
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
HashMap<String, PortfolioStock> getStocks() {
if (!isDirtyPortfolioStockMap()) {
return mPortfolioStocks;
}
mPortfolioStocks.clear();
- 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
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
- 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
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;
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();
- 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
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
- 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
Method onResume
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onResume() {
super.onResume();
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,
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
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()) {
- 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
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;