Showing 3,654 of 3,654 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
export function createChangeStyleSuggestion(style, active) {
return {
type: 'CREATE_CHANGE_STYLE_SUGGESTION',
payload: {
style: style,
- 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 60.
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
this.statusOptions = [
{name: gettext('All'), value: null},
{name: gettext('Active'), value: 'true'},
{name: gettext('Inactive'), value: 'false'},
];
- 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 60.
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
return _getAllProducts()
.then((result) => {
self.products = result;
_.each(result._items, (product) => {
self.productLookup[product._id] = product;
- 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 60.
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 runFetchImages
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
runFetchImages() {
const formattedTags: Array<ITagInput> = this.formatTags(
toServerFormat(this.props.data, superdesk),
);
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(props: IProps) {
super(props);
const {stringToNumber, filterKeys} = superdeskApi.helpers;
this.state = {
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {availableFields} = this.props;
return (
<div>
Function handleCheckingVideo
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleCheckingVideo(resetState: boolean = true, callback?: () => void) {
this.intervalCheckVideo = window.setInterval(() => {
this.props.superdesk.dataApi
.findOne<IVideoProject>('video_edit', this.state.article._id)
.then((result) => {
Function queryMimetypes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function queryMimetypes(source: IRootElasticQuery, params: IAssetSearchParams) {
if (params.mimetypes === ASSET_TYPE_FILTER.DOCUMENTS) {
source.query.bool.must_not.push(
superdeskApi.elasticsearch.queryString({
query: 'mimetype:(image\\/*) OR mimetype:(video\\/*) OR mimetype:(audio\\/*)',
Function getFieldV2
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFieldV2: (fieldEditor, fieldSchema) => {
const vocabulary = sdApi.vocabularies.getAll().get('priority');
// HAS TO BE SYNCED WITH styles/sass/labels.scss
var defaultPriorityColors = {
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {config} = this.props;
const Container = this.props.container;
const values = this.props.value;
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(): React.ReactNode {
return (
<Button
icon="settings"
shape="round"
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const lockedInOtherSession = isLockedInOtherSession(this.props.entity);
if (lockedInOtherSession !== true) {
return null;
Function arrangeLabels
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function arrangeLabels() {
var move = 1;
while (move > 0) {
move = 0;
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {scope, svc} = this.props;
const _createItem = function createItem(itemId) {
const item = this.state.itemsById[itemId];
Function upload
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.upload = function(config) {
var form: any = {};
form.CropLeft = Math.round(Math.min(config.cords.x, config.cords.x2));
form.CropRight = Math.round(Math.max(config.cords.x, config.cords.x2));
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {item, showAltText, className} = this.props;
const validator = appConfig.validator_media_metadata;
const NO_VALUE_LABEL = gettext('[No Value]');
Function save
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.save = function() {
return authoring.save(
$scope.origItem,
$scope.item,
$scope.requestEditor3DirectivesToGenerateHtml,
Function dataSource
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
dataSource(fetchFn) {
const markedQuery = extensions['markForUser']
?.extension
.exposes
.getQueryNotMarkedForAnyoneOrMarkedForMe(userId);
Function link
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope) {
scope.transmitted_item = null;
scope.show_transmission_details = false;
/**
Function MediaPreview
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MediaPreview: React.StatelessComponent<IProps> = (props) => {
const {item, multiSelect} = props;
const headline = item.headline || item.slugline || item.type;
// headline could contains html tags hence stripping for tooltips
const headlineText = headline.replace(/(<([^>]+)>)/ig, '');