Showing 387 of 387 total issues
Method deleteHiveTest
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void deleteHiveTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.fab_add_apiary),
withParent(withId(R.id.coordinatorLayout)),
Method setupBeesChart
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void setupBeesChart(List<Record> recordsList) {
// Setup data
referenceTimestamp = recordsList.get(0).getTimestamp().getTime() / 1000;
Record[] records = recordsList.toArray(new Record[recordsList.size()]);
List<Entry> entries = new ArrayList<>();
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (addEditHiveFragment == null) {
addEditHiveFragment = AddEditHiveFragment.newInstance();
if (getIntent().hasExtra(AddEditHiveFragment.ARGUMENT_EDIT_HIVE_ID)) {
// If edit -> set edit title
if (actionBar != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 126.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (addEditApiaryFragment == null) {
addEditApiaryFragment = AddEditApiaryFragment.newInstance();
if (getIntent().hasExtra(AddEditApiaryFragment.ARGUMENT_EDIT_APIARY_ID)) {
// If edit -> set edit title
if (actionBar != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 126.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method settingsTest
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void settingsTest() {
ViewInteraction appCompatImageButton = onView(
allOf(withContentDescription("Navigate up"),
withParent(withId(R.id.toolbar)),
Method checkLocationPermission
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public boolean checkLocationPermission() {
// Check location permission
if (PermissionUtils.isGranted(getActivity(), PermissionEnum.ACCESS_FINE_LOCATION)) {
return true;
Method listApiariesTest
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void listApiariesTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.fab_add_apiary),
withParent(withId(R.id.coordinatorLayout)),
Method aboutTest
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void aboutTest() {
ViewInteraction appCompatImageButton = onView(
allOf(withContentDescription("Navigate up"),
withParent(withId(R.id.toolbar)),
Method showInfo
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("ConstantConditions")
@Override
public void showInfo(Apiary apiary, Date lastRevisionDate) {
// GENERAL INFO
// Location
Method checkCameraPermission
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public boolean checkCameraPermission() {
// Check camera permission
if (PermissionUtils.isGranted(getActivity(), PermissionEnum.CAMERA)) {
return true;
Similar blocks of code found in 2 locations. Consider refactoring. Open
/*
* GoBees
* Copyright (c) 2016 - 2017 David Miguel Lozano
*
* This program is free software: you can redistribute it and/or modify
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 112.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
/*
* GoBees
* Copyright (c) 2016 - 2017 David Miguel Lozano
*
* This program is free software: you can redistribute it and/or modify
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 112.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
private Location getRandomNearLocation(double latitude, double longitude) {
Random random = new Random();
double lat = BigDecimal.valueOf(latitude + random.nextInt(100) / 100d)
.setScale(7, RoundingMode.HALF_UP).doubleValue();
double lon = BigDecimal.valueOf(longitude + random.nextInt(100) / 100d)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 111.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
private Location getRandomNearLocation(double latitude, double longitude) {
Random random = new Random();
double lat = BigDecimal.valueOf(latitude + random.nextInt(100) / 100d)
.setScale(7, RoundingMode.HALF_UP).doubleValue();
double lon = BigDecimal.valueOf(longitude + random.nextInt(100) / 100d)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 111.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method onStartCommand
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
// START action
Method deleteApiaryTest
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void deleteApiaryTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.fab_add_apiary),
withParent(withId(R.id.coordinatorLayout)),
Method addHiveTest
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void addHiveTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.fab_add_apiary),
withParent(withId(R.id.coordinatorLayout)),
Method checkCurrentWeather
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private void checkCurrentWeather(boolean forceUpdate, List<Apiary> apiaries) {
List<Apiary> apiariesToUpdate = new ArrayList<>();
Date now = new Date();
// Check dates
for (Apiary apiary : apiaries) {
- 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 editApiaryTest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void editApiaryTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.fab_add_apiary),
withParent(withId(R.id.coordinatorLayout)),
Method viewApiaryTest
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void viewApiaryTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.fab_add_apiary),
withParent(withId(R.id.coordinatorLayout)),