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
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;
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);
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
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;
Widget
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
public interface Widget {
Storage getStorage();
void setWidgetPreferencesFromJson(JSONObject jsonPrefs);
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 {
- 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 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);
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;
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 {
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
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;
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);
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);
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]) {
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) {
- 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 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);
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);
- 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 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) {
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;
- 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"