Showing 19 of 104 total issues
Method test
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Test
// Run SerializeTestUtil.serializeLogin first to generate saved sessions
public void test()
throws IGLoginException, IGResponseException, ClassNotFoundException,
FileNotFoundException, IOException {
File IGClient.java
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.instagram4j.instagram4j;
import java.io.File;
import java.io.IOException;
import java.io.ObjectStreamException;
Method segments
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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);
Method uploadTest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
Method uploadTest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
Method applyHeaders
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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() {
Method resolveChallenge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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();
- Read upRead up
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
Open
@Test
// Run SerializeTestUtil.serializeLogin first to generate saved sessions
public void test()
throws IGLoginException, IGResponseException, ClassNotFoundException,
FileNotFoundException, IOException {
- Read upRead up
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
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
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
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
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
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
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
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
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
Open
private FbsearchPlacesRequest getFbsearchPlacesRequest(String user, Double lat, Double lon,
String page_token, String rank_token) {