Showing 3,654 of 3,654 total issues
Function render
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {gettext} = superdeskApi.localization;
const {set, storageDestination, count} = this.props;
if (set?._id == null) {
Function render
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {getClass} = this.props;
const video = this.props.video;
const left = video ? `${(this.state.trim.start / video.duration) * 100}%` : '0%';
const right = video ? `${(1 - this.state.trim.end / video.duration) * 100}%` : '0%';
Function render
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const hasComments = this.state.comments?.length > 0;
const widgetBody: JSX.Element = hasComments
? (
Function initSelectedFacets
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initSelectedFacets(urlParams) {
let promises = $q.all([desks.initialize(), subscribersService.initialize()]);
return promises.then((result) => {
tags.selectedFacets = {};
Function SaveSearch
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SaveSearch($location, asset, api, notify, $rootScope) {
return {
templateUrl: asset.templateUrl('apps/search/views/save-search.html'),
link: function(scope, _elem) {
scope.edit = null;
Function init
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init(loadData?) {
var params = $location.search();
scope.query = params.q;
scope.flags = false;
Function link
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope: IScope) {
const getSelectedItems = () => multi.getItems();
const unselectAll = () => multi.reset();
const multiActions = getMultiActions(
Function render
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {debounced} = this.props;
const {searchBarExtended} = this.state;
const _uniqueId = this.state.uniqueId;
const minLength = this.props.minLength ? this.props.minLength : 2;
Function UserNotificationsService
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UserNotificationsService(
$rootScope,
$timeout,
api,
session,
Function itemTemplate
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.itemTemplate = (templateProps) => {
const template = templateProps.entity;
const actions: Array<IMenuItem> = [
{
Function render
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const ContentPanel = this.getContentPanelComponent();
const actions: Array<IAssetCallback> =
[{
Function LegalArchiveService
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function LegalArchiveService(api, $location, moment, sortService) {
var DEFAULT_PER_PAGE = 25;
this.default_items = Object.freeze({_meta: {max_results: DEFAULT_PER_PAGE, page: 1, total: 1}});
Function link
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, elem, attrs) {
let expiryfield = attrs.expiryfield;
scope.contentExpiry = {
expire: true,
Function UserRolesDirective
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function UserRolesDirective(api, notify, modal, $filter, _, metadata) {
return {
scope: true,
templateUrl: 'scripts/apps/users/views/settings-roles.html',
link: function(scope) {
Function UserMentionDirective
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function UserMentionDirective(userList, desks, asset, $q) {
return {
templateUrl: asset.templateUrl('apps/users/views/mentions.html'),
link: function(scope, elem) {
scope.users = [];
Function link
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, element, attrs) {
var width = 105,
height = 100,
r = Math.min(width, height) * 0.8 * 0.5,
dayBg = '#d4d8de',
Function render
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {options} = this.props;
if (this.props.item.authors == null || options == null) {
return null;
Function showUnsavedChangesPrompt
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function showUnsavedChangesPrompt(
itemOpen?: boolean, // if not open, instead of option to save item, it will show an option to open it first
) {
return new Promise((resolve) => {
if (itemOpen === true) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
const getSaveAsTemplate = (getItem: IExposedFromAuthoring<IArticle>['getLatestItem']): IAuthoringAction => ({
label: gettext('Save as template'),
onTrigger: () => (
showModal(({closeModal}) => {
return (
- 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 95.
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
<FormItem>
<DatePicker
label={gettext('Uploaded To:')}
value={this.state.localSearchParams.dateTo ?? null}
onChange={this.onChange.dateTo}
- 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 95.
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