Showing 67 of 108 total issues
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;
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;
Method loadQuotes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private HashMap<String, StockQuote> loadQuotes() {
if (mCachedQuotes != null && !mCachedQuotes.isEmpty()) {
return mCachedQuotes;
}
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void onResume() {
super.onResume();
- 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 onSharedPreferenceChanged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
// Perform some custom handling of some values
if (key.startsWith("Stock") && !key.endsWith("_summary")) {
- 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 inputWithCallback
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static void inputWithCallback(Context context, String title, String body,
String positiveButtonText, String negativeButtonText,
String defaultInputText,
final InputAlertCallable callable) {
Method updateStock
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public void updateStock(String symbol, String price, String date, String quantity,
String limitHigh, String limitLow, String customDisplay) {
Method alertWithCallback
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Context context,
String title,
String body,
String positiveButtonText,
String negativeButtonText,
Method populateDisplayTotalChange
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private void populateDisplayTotalChange(NumberFormat numberFormat, String symbol, PortfolioStock stock, Map<String, String> itemInfo, String currentPrice, String buyPrice) {
Method getTrimmedDouble
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static String getTrimmedDouble(double number, int digits, Integer maxPrecision) {
String numberAsString = Double.toString(number);
// Find the position of the decimal point
int decimalPos = numberAsString.indexOf(".");
- 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 populateDisplayHoldingValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void populateDisplayHoldingValue(NumberFormat numberFormat, String symbol, PortfolioStock stock, Map<String, String> itemInfo, String currentPrice) {
Method applyUpdate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static void applyUpdate(Context context, int appWidgetId, UpdateType updateMode,
HashMap<String, StockQuote> quotes, String quotesTimeStamp) {
Method query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
Method populateDisplayLastChange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void populateDisplayLastChange(NumberFormat numberFormat, String symbol, StockQuote quote, PortfolioStock stock, Map<String, String> itemInfo) {
Method choiceWithCallback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Context context,
String title,
String negativeButtonText,
final CharSequence[] choices,
final InputAlertCallable callable
Method query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
if (!TextUtils.isEmpty(selection)) {
throw new IllegalArgumentException("selection not allowed for " + uri);
}
- 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 getImageViewSrcId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private int getImageViewSrcId(String backgroundStyle, Boolean useLargeFont) {
Integer imageViewSrcId;
switch (backgroundStyle) {
case "transparent":
if (useLargeFont) {
- 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 updateFromGlobal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void updateFromGlobal(SharedPreferences sharedPreferences, String key, int valType) {
// Unregister the listener whenever a key changes
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
// Update the widget preferences with the interval
- 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 getLabel
has a Cognitive Complexity of 6 (exceeds 5 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]) {
- 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 buildRequestUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private String buildRequestUrl(List<String> symbols) {
StringBuilder sQuery = new StringBuilder();
for (String s : symbols) {
if (!s.equals("")) {
if (!sQuery.toString().equals("")) {
- 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"