Showing 27 of 230 total issues
File onedrive_client.js
has 816 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
let storedAppInfo = null;
let appInfo = {
- Create a ticket
File onedrive_fs.js
has 501 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
// Constants
// Use set DEBUG_ENABLED to true to enable verbose logging (alpha builds)
const DEBUG_ENABLED = true;
- Create a ticket
OneDriveClient
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class OneDriveClient {
// Constructor
constructor(onedriveFS) {
- Create a ticket
OneDriveFS
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class OneDriveFS {
// Constructor
constructor() {
- Create a ticket
Function handleError
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
handleError(error, textStatus, errorThrown) {
const status = Number(error.status);
if (status === 404 || status === 409) {
console.debug(error);
this.errorCallback_('NOT_FOUND');
- Read upRead up
- Create a ticket
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
Function authorize
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
authorize(successCallback, errorCallback) {
this.access_token_ = this.getTokenFromCookie('access');
if (this.access_token_) {
successCallback();
}
- Create a ticket
Function assignEventHandlers
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
assignEventHandlers() {
chrome.alarms.onAlarm.addListener(alarm => {
if (alarm.name === 'onedrive_alarm') {
this.onAlarm(alarm);
}
- Create a ticket
Function background
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const background = () => {
if (!chrome.fileSystemProvider) {
console.log('There is no chrome.fileSystemProvider API. See you on ChromeOS!');
return;
}
- Create a ticket
Consider simplifying this complex logical expression. Open
Open
if (window.FormData &&
((options.dataType && (options.dataType === 'binary')) ||
(options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) ||
(window.Blob && options.data instanceof Blob))))) {
return {
- Create a ticket
Function truncate
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
truncate(filePath, length, successCallback, errorCallback) {
console.log('doing truncate');
const data = this.jsonStringify({
path: filePath
});
- Create a ticket
Function handleError
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleError(error, textStatus, errorThrown) {
const status = Number(error.status);
if (status === 404 || status === 409) {
console.debug(error);
this.errorCallback_('NOT_FOUND');
- Create a ticket
Function getMetadata
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getMetadata(path, successCallback, errorCallback) {
this.onedrive_fs_.writeLog('debug', 'getMetadata path:', path);
if (path === '/') {
successCallback({
- Create a ticket
Function mount
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
mount(successCallback, errorCallback) {
const onedriveClient = new OneDriveClient(this);
onedriveClient.authorize(() => {
onedriveClient.getDriveData((driveInfo) => {
onedriveClient.getUserInfo((userInfo) => {
- Create a ticket
Function refreshToken
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
refreshToken(successCallback, errorCallback){
this.refresh_token_ = this.getTokenFromCookie('refresh');
var appInfo = this.getAppInfo();
var fileSystemId = 'onedrivefs://' + this.uid_;
//var thisvalue = this.onedrive_fs_.fileSystemId;
- Create a ticket
Function watchDirectory
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
watchDirectory(fileSystemId, onedriveClient, entryPath) {
this.useOptions('useWatcher', use => {
if (!use) {
return;
}
- Create a ticket
Function createEventHandler
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createEventHandler(callback) {
return (options, successCallback, errorCallback) => {
const fileSystemId = options.fileSystemId;
const onedriveClient = this.getOneDriveClient(fileSystemId);
if (!onedriveClient) {
- Create a ticket
Function sendContents
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
sendContents(options, successCallback, errorCallback) {
if (!options.hasMore) {
successCallback();
} else {
var len = options.data.byteLength;
- Create a ticket
Function get
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MetadataCache.prototype.get = function(entryPath) {
if (entryPath === "/") {
return {
needFetch: true,
exists: true
- Create a ticket
Function createOrDeleteEntry
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createOrDeleteEntry(operation, path, successCallback, errorCallback) {
this.onedrive_fs_.writeLog('debug', 'client-createOrDeleteEntry-' + operation, path);
var url = "https://graph.microsoft.com/v1.0/me/drive/root";
var data = JSON.stringify({
path: path
- Create a ticket
Function closeFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
closeFile(filePath, openRequestId, mode, successCallback, errorCallback) {
const writeRequest = this.writeRequestMap[openRequestId];
if (writeRequest && mode === 'WRITE') {
const uploadId = writeRequest.uploadId;
if (uploadId) {
- Create a ticket