brunocvcunha/instagram4j

View on GitHub

Showing 19 of 104 total issues

Method test has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Test
    // Run SerializeTestUtil.serializeLogin first to generate saved sessions
    public void test()
            throws IGLoginException, IGResponseException, ClassNotFoundException,
            FileNotFoundException, IOException {
Severity: Major
Found in src/examples/java/live/LiveTest.java - About 2 hrs to fix

    File IGClient.java has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.github.instagram4j.instagram4j;
    
    import java.io.File;
    import java.io.IOException;
    import java.io.ObjectStreamException;
    Severity: Minor
    Found in src/main/java/com/github/instagram4j/instagram4j/IGClient.java - About 2 hrs to fix

      Method segments has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public CompletableFuture<IGResponse> segments(String upload_id, byte[][] segments,
                  int totalLengthBytes) {
              String transfer_id = upload_id;
              UploadParameters parameter = UploadParameters.forIgtv(upload_id);
      
      

        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

          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

                  Method test has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Test
                      // Run SerializeTestUtil.serializeLogin first to generate saved sessions
                      public void test()
                              throws IGLoginException, IGResponseException, ClassNotFoundException,
                              FileNotFoundException, IOException {
                  Severity: Minor
                  Found in src/examples/java/live/LiveTest.java - About 45 mins to fix

                  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

                  Method setStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public CompletableFuture<IGResponse> setStatus(String text, String emoji, long expires_at, boolean should_notify, String status_type) {

                    Method configureToIgtv has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public static CompletableFuture<MediaConfigureToIgtvResponse> configureToIgtv(IGClient client, String upload_id, String title, String caption, boolean postToFeed) {

                      Method upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public CompletableFuture<MediaConfigureToIgtvResponse> upload(File videoFile, File coverFile,
                                  String title, String caption, boolean postToFeed) {

                        Method searchPlace has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public CompletableFuture<FbsearchPlacesResponse> searchPlace(String location, double lat,
                                    double lon,
                                    String page_token, String rank_token) {

                          Method retry has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public static <T> CompletableFuture<T> retry(Supplier<CompletableFuture<T>> action,
                                      Throwable error,
                                      int tries, long delay, TimeUnit unit) {

                            Method searchTag has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public CompletableFuture<TagsSearchResponse> searchTag(String location, double lat, double lon,
                                        String page_token, String rank_token) {

                              Method upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public CompletableFuture<MediaConfigureToIgtvResponse> upload(byte[] data, byte[] cover,
                                          String title, String caption, boolean postToFeed) {

                                Method getSearchTagRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    private TagsSearchRequest getSearchTagRequest(String tag, Double lat, Double lon,
                                            String page_token, String rank_token) {

                                  Method getFbsearchPlacesRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      private FbsearchPlacesRequest getFbsearchPlacesRequest(String user, Double lat, Double lon,
                                              String page_token, String rank_token) {
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language