glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  const {
    type,
    src,
    currentTime,
    accountId,
app/javascript/mastodon/features/picture_in_picture/index.tsx on lines 24..36

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 63.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

export const scrollRight = (node: Element, position: number) => {
  if (isScrollBehaviorSupported)
    node.scrollTo({ left: position, behavior: 'smooth' });
  else scroll(node, 'scrollLeft', position);
};
Severity: Major
Found in app/javascript/flavours/glitch/scroll.ts and 1 other location - About 1 hr to fix
app/javascript/mastodon/scroll.ts on lines 41..45

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 63.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

Rails.delegate(document, '.sidebar__toggle__icon', 'keydown', (e) => {
  if (e.key === ' ' || e.key === 'Enter') {
    e.preventDefault();
    toggleSidebar();
  }
Severity: Major
Found in app/javascript/flavours/glitch/entrypoints/public.tsx and 1 other location - About 1 hr to fix
app/javascript/entrypoints/public.tsx on lines 381..386

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 63.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

Rails.delegate(document, '.sidebar__toggle__icon', 'keydown', (e) => {
  if (e.key === ' ' || e.key === 'Enter') {
    e.preventDefault();
    toggleSidebar();
  }
Severity: Major
Found in app/javascript/entrypoints/public.tsx and 1 other location - About 1 hr to fix
app/javascript/flavours/glitch/entrypoints/public.tsx on lines 381..386

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 63.

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

Further Reading

Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { limit } = this.props;
    const { loading, data } = this.state;

    let content;
Severity: Minor
Found in app/javascript/flavours/glitch/components/admin/Trends.jsx - About 1 hr to fix

    Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render () {
        const { loading, data } = this.state;
    
        return (
          <div className='dimension'>
    Severity: Minor
    Found in app/javascript/flavours/glitch/components/admin/ImpactReport.jsx - About 1 hr to fix

      Function getTicks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getTicks (count, size, radius, scaleCoefficient) {
          const ticks = this.getTickPoints(count);
          const lesser = 200;
          const m = [];
          const bufferLength = this.analyser ? this.analyser.frequencyBinCount : 0;
      Severity: Minor
      Found in app/javascript/flavours/glitch/features/audio/visualizer.js - About 1 hr to fix

        Function searchValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const searchValue = (value) => {
              let aPool = pool,
                aIndex = index,
                length = 0;
        
        

          Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render () {
              const { value, intl, frequentlyUsedLanguages } = this.props;
              const { open, placement } = this.state;
              const current = preloadedLanguages.find(lang => lang[0] === value) ?? [];
          
          

            Function stringFromCodePoint has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const stringFromCodePoint = _String.fromCodePoint || function () {
              let MAX_SIZE = 0x4000;
              let codeUnits = [];
              let highSurrogate;
              let lowSurrogate;
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/emoji/emoji_utils.js - About 1 hr to fix

              Function Share has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const Share = () => {
                const account = useAppSelector(state => state.getIn(['accounts', me]));
                const intl = useIntl();
                const url = (new URL(`/@${account.get('username')}`, document.baseURI)).href;
              
              
              Severity: Minor
              Found in app/javascript/flavours/glitch/features/onboarding/share.jsx - About 1 hr to fix

                Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render () {
                    const { value, container, disabled, intl } = this.props;
                    const { open, placement } = this.state;
                
                    const valueOption = this.options.find(item => item.value === value);

                  Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render () {
                      const { loading, data } = this.state;
                  
                      return (
                        <div className='dimension'>
                  Severity: Minor
                  Found in app/javascript/mastodon/components/admin/ImpactReport.jsx - About 1 hr to fix

                    Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render () {
                        const { limit } = this.props;
                        const { loading, data } = this.state;
                    
                        let content;
                    Severity: Minor
                    Found in app/javascript/mastodon/components/admin/Trends.jsx - About 1 hr to fix

                      Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render () {
                          const { value, intl, frequentlyUsedLanguages } = this.props;
                          const { open, placement } = this.state;
                          const current = preloadedLanguages.find(lang => lang[0] === value) ?? [];
                      
                      

                        Function getTicks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          getTicks (count, size, radius, scaleCoefficient) {
                            const ticks = this.getTickPoints(count);
                            const lesser = 200;
                            const m = [];
                            const bufferLength = this.analyser ? this.analyser.frequencyBinCount : 0;
                        Severity: Minor
                        Found in app/javascript/mastodon/features/audio/visualizer.js - About 1 hr to fix

                          Function searchValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              const searchValue = (value) => {
                                let aPool = pool,
                                  aIndex = index,
                                  length = 0;
                          
                          
                          Severity: Minor
                          Found in app/javascript/mastodon/features/emoji/emoji_mart_search_light.js - About 1 hr to fix

                            Function stringFromCodePoint has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const stringFromCodePoint = _String.fromCodePoint || function () {
                              let MAX_SIZE = 0x4000;
                              let codeUnits = [];
                              let highSurrogate;
                              let lowSurrogate;
                            Severity: Minor
                            Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 1 hr to fix

                              Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                render () {
                                  const { value, container, disabled, intl } = this.props;
                                  const { open, placement } = this.state;
                              
                                  const valueOption = this.options.find(item => item.value === value);

                                Function renderPoll has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  renderPoll (notification, account) {
                                    const { intl, unread, status } = this.props;
                                    const ownPoll  = me === account.get('id');
                                    const message  = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll);
                                
                                
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language