brunocvcunha/instagram4j

View on GitHub

Showing 104 of 104 total issues

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

package com.github.instagram4j.instagram4j.actions.feed;

import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
src/main/java/com/github/instagram4j/instagram4j/actions/feed/PageRankIterable.java on lines 1..44

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

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

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

package com.github.instagram4j.instagram4j.actions.feed;

import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
src/main/java/com/github/instagram4j/instagram4j/actions/feed/FeedIterable.java on lines 1..43

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

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

Method encryptPassword has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @SneakyThrows
    public static String encryptPassword(String password, String enc_id, String enc_pub_key) {
        byte[] rand_key = new byte[32], iv = new byte[12];
        SecureRandom sran = new SecureRandom();
        sran.nextBytes(rand_key);
Severity: Minor
Found in src/main/java/com/github/instagram4j/instagram4j/utils/IGUtils.java - About 1 hr to fix

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

        @Test
        // Run SerializeTestUtil.serializeLogin first to generate saved sessions
        public void testSearchUser() throws Exception {
            IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
            client.actions().search().searchUser("Kim Kardashian")
    Severity: Major
    Found in src/examples/java/actions/SearchActionTest.java and 1 other location - About 1 hr to fix
    src/examples/java/actions/SearchActionTest.java on lines 25..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 79.

    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

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

        @Test
        // Run SerializeTestUtil.serializeLogin first to generate saved sessions
        public void testSearchLocation() throws Exception {
            IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
            client.actions().search().searchPlace("San Francisco").thenAccept(res -> {
    Severity: Major
    Found in src/examples/java/actions/SearchActionTest.java and 1 other location - About 1 hr to fix
    src/examples/java/actions/SearchActionTest.java on lines 38..50

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

    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

    Method uploadTest has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Test
        // Run SerializeTestUtil.serializeLogin first to generate saved sessions
        public void uploadTest()
                throws IGLoginException, IOException, IGResponseException, ClassNotFoundException {
            IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
    Severity: Minor
    Found in src/examples/java/upload/UploadAlbumTest.java - About 1 hr to fix

      Method uploadTest has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Test
          // Run SerializeTestUtil.serializeLogin first to generate saved sessions
          public void uploadTest()
                  throws IGLoginException, IOException, IGResponseException, ClassNotFoundException {
              IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
      Severity: Minor
      Found in src/examples/java/upload/UploadStoryPhotoTest.java - About 1 hr to fix

        Method applyHeaders has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected Request.Builder applyHeaders(IGClient client, Request.Builder req) {
                req.addHeader("Connection", "close");
                req.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                req.addHeader("Accept-Language", "en-US");
                req.addHeader("X-IG-Capabilities", client.getDevice().getCapabilities());

          Method sendRequest has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public <T extends IGResponse> CompletableFuture<T> sendRequest(@NonNull IGRequest<T> req) {
                  CompletableFuture<Pair<Response, String>> responseFuture = new CompletableFuture<>();
                  log.info("Sending request : {}", req.formUrl(this).toString());
                  this.httpClient.newCall(req.formRequest(this)).enqueue(new Callback() {
          
          
          Severity: Minor
          Found in src/main/java/com/github/instagram4j/instagram4j/IGClient.java - About 1 hr to fix

            Method resolveChallenge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public static LoginResponse resolveChallenge(@NonNull IGClient client,
                        @NonNull LoginResponse response,
                        @NonNull Callable<String> inputCode, int retries) {
                    Challenge challenge = response.getChallenge();
                    ChallengeStateResponse stateResponse = requestState(client, challenge).join();

            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

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

                @Test
                // Run SerializeTestUtil.serializeLogin first to generate saved sessions
                public void testComment() throws Exception {
                    IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
                    LiveBroadcastCommentRequest IGRequest =
            Severity: Major
            Found in src/examples/java/live/LiveActionsTest.java and 2 other locations - About 55 mins to fix
            src/examples/java/live/LiveActionsTest.java on lines 81..91
            src/examples/java/live/LiveActionsTest.java on lines 93..102

            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

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

            package com.github.instagram4j.instagram4j.requests.media;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.requests.IGGetRequest;
            import com.github.instagram4j.instagram4j.requests.IGPaginatedRequest;
            src/main/java/com/github/instagram4j/instagram4j/requests/media/MediaGetStoryPollVotersRequest.java on lines 1..37

            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

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

                @Test
                // Run SerializeTestUtil.serializeLogin first to generate saved sessions
                public void testWave() throws Exception {
                    IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
                    LiveWaveRequest IGRequest = new LiveWaveRequest(BROADCAST_ID, "");
            Severity: Major
            Found in src/examples/java/live/LiveActionsTest.java and 2 other locations - About 55 mins to fix
            src/examples/java/live/LiveActionsTest.java on lines 23..34
            src/examples/java/live/LiveActionsTest.java on lines 81..91

            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

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

            package com.github.instagram4j.instagram4j.requests.media;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.requests.IGGetRequest;
            import com.github.instagram4j.instagram4j.requests.IGPaginatedRequest;
            src/main/java/com/github/instagram4j/instagram4j/requests/media/MediaGetStoryQuestionResponsesRequest.java on lines 1..38

            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

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

                @Test
                // Run SerializeTestUtil.serializeLogin first to generate saved sessions
                public void testBroadcastQuestions() throws Exception {
                    IGClient client = SerializeTestUtil.getClientFromSerialize("igclient.ser", "cookie.ser");
                    LiveBroadcastQuestionsRequest IGRequest =
            Severity: Major
            Found in src/examples/java/live/LiveActionsTest.java and 2 other locations - About 55 mins to fix
            src/examples/java/live/LiveActionsTest.java on lines 23..34
            src/examples/java/live/LiveActionsTest.java on lines 93..102

            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

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

            package com.github.instagram4j.instagram4j.requests.music;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.models.IGPayload;
            import com.github.instagram4j.instagram4j.requests.IGPostRequest;
            src/main/java/com/github/instagram4j/instagram4j/requests/music/MusicGenresIdRequest.java on lines 1..35

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

            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

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

            package com.github.instagram4j.instagram4j.requests.feed;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.requests.IGGetRequest;
            import com.github.instagram4j.instagram4j.requests.IGPaginatedRequest;
            src/main/java/com/github/instagram4j/instagram4j/requests/feed/FeedLocationRequest.java on lines 1..37
            src/main/java/com/github/instagram4j/instagram4j/requests/media/MediaGetCommentsRequest.java on lines 1..36
            src/main/java/com/github/instagram4j/instagram4j/requests/media/MediaListReelMediaViewerRequest.java on lines 1..37

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

            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

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

            package com.github.instagram4j.instagram4j.requests.music;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.models.IGPayload;
            import com.github.instagram4j.instagram4j.requests.IGPostRequest;
            src/main/java/com/github/instagram4j/instagram4j/requests/music/MusicMoodsIdRequest.java on lines 1..35

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

            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

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

            package com.github.instagram4j.instagram4j.requests.media;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.requests.IGGetRequest;
            import com.github.instagram4j.instagram4j.requests.IGPaginatedRequest;
            src/main/java/com/github/instagram4j/instagram4j/requests/feed/FeedLocationRequest.java on lines 1..37
            src/main/java/com/github/instagram4j/instagram4j/requests/feed/FeedTagRequest.java on lines 1..37
            src/main/java/com/github/instagram4j/instagram4j/requests/media/MediaListReelMediaViewerRequest.java on lines 1..37

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

            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

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

            package com.github.instagram4j.instagram4j.requests.live;
            
            import com.github.instagram4j.instagram4j.IGClient;
            import com.github.instagram4j.instagram4j.requests.IGGetRequest;
            import com.github.instagram4j.instagram4j.responses.live.LiveBroadcastLikeResponse.LiveBroadcastGetLikeCountResponse;
            src/main/java/com/github/instagram4j/instagram4j/requests/live/LiveBroadcastGetCommentRequest.java on lines 1..33

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

            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

            Severity
            Category
            Status
            Source
            Language