Showing 3,654 of 3,654 total issues
Function canRewrite
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function canRewrite(item: IArticle): true | Array<string> {
const errors = [];
if (
isReadOnly(item)
Function StreamController
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function StreamController($scope, api, $rootScope, desks) {
$scope.desk = null;
$scope.activities = null;
$scope.pageLength = 10;
$scope.max_results = $scope.pageLength;
Function buildGeneralFilters
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildGeneralFilters(paramsObject, query) {
if (paramsObject.urgency) {
query.post_filter({terms: {urgency: JSON.parse(paramsObject.urgency)}});
}
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const showSelect = this.state.hover || this.props.itemSelected;
return (
<div
Function getFieldTypeForFiltering
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFieldTypeForFiltering(type: FormFieldType): FormFieldType {
switch (type) {
case FormFieldType.plainText:
return FormFieldType.plainText;
case FormFieldType.textEditor3:
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<Modal
visible
zIndex={1050}
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (this.props.previewOutput) {
return <div>{this.props.value ? gettext('Yes') : gettext('No')}</div>;
}
Function getFormFieldComponent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getFormFieldComponent(type: FormFieldType): React.ComponentType<IInputType<any>> {
switch (type) {
case FormFieldType.plainText:
return PlainText;
case FormFieldType.textEditor3:
Function constructor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(props: IProps<T>) {
super(props);
this.state = {
search: '',
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {markupV2} = this.props;
return (
<React.Fragment>
Function getQueryWithFilters
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getQueryWithFilters(
originalQuery: ISuperdeskQuery,
filters: IState['activeFilters'],
fullTextSearch: string,
sortOption: ISortOption,
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (this.props.previewOutput) {
return <UserHtmlSingleLine html={this.props.value} showAsPlainText={!!this.props.showAsPlainText} />;
}
Function link
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, element, attrs) {
const SIZE = 25;
scope.pgsizes = [SIZE, SIZE * 2, SIZE * 4];
Function onSubmit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSubmit(linkType) {
let link;
const {suggestingMode, localDomains} = this.props;
const _createLinkSuggestion = this.props.createLinkSuggestion;
const _applyLink = this.props.applyLink;
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {block, contentState} = this.props;
const entityKey = block.getEntityAt(0);
const entity = contentState.getEntity(entityKey);
const {item} = entity.getData() as IEditorDragDropArticleEmbed['data'];
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (warnAboutLosingChanges) {
return superdesk.ui.confirm('Discard unsaved changes?').then((confirmed) => {
if (confirmed) {
doClose();
}
- 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 59.
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
edit(
item: {_id: IArticle['_id'], _type?: IArticle['_type'], state?: IArticle['state']},
action?: IAuthoringActionType,
) {
return sdApi.article.edit(item, action);
- 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 59.
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
function edit(
item: {
_id: IArticle['_id'],
_type?: IArticle['_type'],
state?: IArticle['state']
- 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 59.
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
Function drawPoint
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawPoint(img, poi = vm.poi) {
var topOffset = poi.y * img.height - circleRadius;
var leftOffset = poi.x * img.width - circleRadius;
var verticalLeftOffset = leftOffset + circleRadius - lineThickness / 2;
var horizontalTopffset = topOffset + circleRadius - lineThickness / 2;
Function backendRequest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function backendRequest(params, callback, retry = 3) {
let cb = callback || function() { /* no-op */ };
let ttl = retry || 0;
if (params.uri) {