Commit 0a0641c9 authored by ZeHiro's avatar ZeHiro Committed by ZeHiro
Browse files

Forbid multiple spaces. Fixes #493

parent 905bbd2b
......@@ -148,7 +148,7 @@
no-magic-numbers:
- 0
no-multi-spaces:
- 0 # TODO
- 2
no-multi-str:
- 2
no-native-reassign:
......
......@@ -9,7 +9,7 @@ import AddOperationModal from './add-operation-modal';
import SyncAccountBalanceModal from './sync-account-balance-modal';
const formatIBAN = function(iban) {
return iban.replace(/(.{4})(?!$)/g, '$1\xa0');
return iban.replace(/(.{4})(?!$)/g, '$1\xa0');
};
export default connect(state => {
......
......@@ -12,7 +12,7 @@ export class Bank {
constructor(arg) {
this.name = assertHas(arg, 'name') && arg.name;
this.uuid = assertHas(arg, 'uuid') && arg.uuid;
this.id = this.uuid;
this.id = this.uuid;
this.customFields = arg.customFields || [];
}
}
......@@ -21,52 +21,52 @@ export class Account {
constructor(arg, defaultCurrency) {
assert(typeof defaultCurrency === 'string', 'defaultCurrency must be a string');
this.bank = assertHas(arg, 'bank') && arg.bank;
this.bankAccess = assertHas(arg, 'bankAccess') && arg.bankAccess;
this.title = assertHas(arg, 'title') && arg.title;
this.accountNumber = assertHas(arg, 'accountNumber') && arg.accountNumber;
this.initialAmount = assertHas(arg, 'initialAmount') && arg.initialAmount;
this.lastChecked = assertHas(arg, 'lastChecked') && new Date(arg.lastChecked);
this.id = assertHas(arg, 'id') && arg.id;
this.iban = (maybeHas(arg, 'iban') && arg.iban) || null;
this.currency = (maybeHas(arg, 'currency') &&
currency.isKnown(arg.currency) &&
arg.currency) ||
defaultCurrency;
this.formatCurrency = currency.makeFormat(this.currency);
this.currencySymbol = currency.symbolFor(this.currency);
this.bank = assertHas(arg, 'bank') && arg.bank;
this.bankAccess = assertHas(arg, 'bankAccess') && arg.bankAccess;
this.title = assertHas(arg, 'title') && arg.title;
this.accountNumber = assertHas(arg, 'accountNumber') && arg.accountNumber;
this.initialAmount = assertHas(arg, 'initialAmount') && arg.initialAmount;
this.lastChecked = assertHas(arg, 'lastChecked') && new Date(arg.lastChecked);
this.id = assertHas(arg, 'id') && arg.id;
this.iban = (maybeHas(arg, 'iban') && arg.iban) || null;
this.currency = (maybeHas(arg, 'currency') &&
currency.isKnown(arg.currency) &&
arg.currency) ||
defaultCurrency;
this.formatCurrency = currency.makeFormat(this.currency);
this.currencySymbol = currency.symbolFor(this.currency);
}
mergeOwnProperties(other) {
assert(this.id === other.id, 'ids of merged accounts must be equal');
this.bank = other.bank;
this.bankAccess = other.bankAccess;
this.title = other.title;
this.accountNumber = other.accountNumber;
this.initialAmount = other.initialAmount;
this.lastChecked = other.lastChecked;
this.iban = other.iban;
this.currency = other.currency;
this.formatCurrency = other.formatCurrency;
this.currencySymbol = other.currencySymbol;
this.bank = other.bank;
this.bankAccess = other.bankAccess;
this.title = other.title;
this.accountNumber = other.accountNumber;
this.initialAmount = other.initialAmount;
this.lastChecked = other.lastChecked;
this.iban = other.iban;
this.currency = other.currency;
this.formatCurrency = other.formatCurrency;
this.currencySymbol = other.currencySymbol;
// No need to merge ids, they're the same
}
}
export class Operation {
constructor(arg) {
this.bankAccount = assertHas(arg, 'bankAccount') && arg.bankAccount;
this.title = assertHas(arg, 'title') && arg.title;
this.date = assertHas(arg, 'date') && new Date(arg.date);
this.amount = assertHas(arg, 'amount') && arg.amount;
this.binary = (maybeHas(arg, 'binary') && arg.binary) || null;
this.attachments = (maybeHas(arg, 'attachments') && arg.attachments) || null;
this.raw = assertHas(arg, 'raw') && arg.raw;
this.dateImport = (maybeHas(arg, 'dateImport') && new Date(arg.dateImport)) || 0;
this.id = assertHas(arg, 'id') && arg.id;
this.categoryId = arg.categoryId || NONE_CATEGORY_ID;
this.type = arg.type || UNKNOWN_OPERATION_TYPE;
this.customLabel = (maybeHas(arg, 'customLabel') && arg.customLabel) || null;
this.bankAccount = assertHas(arg, 'bankAccount') && arg.bankAccount;
this.title = assertHas(arg, 'title') && arg.title;
this.date = assertHas(arg, 'date') && new Date(arg.date);
this.amount = assertHas(arg, 'amount') && arg.amount;
this.binary = (maybeHas(arg, 'binary') && arg.binary) || null;
this.attachments = (maybeHas(arg, 'attachments') && arg.attachments) || null;
this.raw = assertHas(arg, 'raw') && arg.raw;
this.dateImport = (maybeHas(arg, 'dateImport') && new Date(arg.dateImport)) || 0;
this.id = assertHas(arg, 'id') && arg.id;
this.categoryId = arg.categoryId || NONE_CATEGORY_ID;
this.type = arg.type || UNKNOWN_OPERATION_TYPE;
this.customLabel = (maybeHas(arg, 'customLabel') && arg.customLabel) || null;
}
}
......
import * as path from 'path';
import americano from 'americano';
import i18n from 'cozy-i18n-helper';
import i18n from 'cozy-i18n-helper';
const nodeEnv = process.env.NODE_ENV;
process.kresus = process.kresus || {};
......
import Access from '../models/access';
import Account from '../models/account';
import Access from '../models/access';
import Account from '../models/account';
import accountManager from '../lib/accounts-manager';
import * as AccountController from './accounts';
......
import Account from '../models/account';
import Operation from '../models/operation';
import Access from '../models/access';
import Alert from '../models/alert';
import Config from '../models/config';
import Account from '../models/account';
import Operation from '../models/operation';
import Access from '../models/access';
import Alert from '../models/alert';
import Config from '../models/config';
import accountManager from '../lib/accounts-manager';
import { makeLogger, KError, asyncErr } from '../helpers';
......
import * as crypto from 'crypto';
import * as crypto from 'crypto';
import Access from '../models/access';
import Account from '../models/account';
import Alert from '../models/alert';
import Category from '../models/category';
import Operation from '../models/operation';
import Config from '../models/config';
import Cozy from '../models/cozyinstance';
import Access from '../models/access';
import Account from '../models/account';
import Alert from '../models/alert';
import Category from '../models/category';
import Operation from '../models/operation';
import Config from '../models/config';
import Cozy from '../models/cozyinstance';
import { run as runMigrations } from '../models/migrations';
......@@ -214,13 +214,13 @@ export async function import_(req, res) {
}
}
world.accesses = world.accesses || [];
world.accounts = world.accounts || [];
world.alerts = world.alerts || [];
world.categories = world.categories || [];
world.accesses = world.accesses || [];
world.accounts = world.accounts || [];
world.alerts = world.alerts || [];
world.categories = world.categories || [];
world.operationtypes = world.operationtypes || [];
world.operations = world.operations || [];
world.settings = world.settings || [];
world.operations = world.operations || [];
world.settings = world.settings || [];
log.info(`Importing:
accesses: ${world.accesses.length}
......
import Category from '../models/category';
import Category from '../models/category';
import Operation from '../models/operation';
import { makeLogger, KError, asyncErr } from '../helpers';
......
......@@ -106,7 +106,7 @@ export async function file(req, res) {
return true;
}
let operationId = req.preloaded.operation.id;
let operationId = req.preloaded.operation.id;
let binaryPath = `/data/${operationId}/binaries/file`;
let id = process.env.NAME;
......
import * as accesses from './accesses';
import * as accounts from './accounts';
import * as accesses from './accesses';
import * as accounts from './accounts';
import * as operations from './operations';
import * as alerts from './alerts';
import * as alerts from './alerts';
import * as categories from './categories';
import * as settings from './settings';
import * as all from './all';
import * as settings from './settings';
import * as all from './all';
module.exports = {
......
......@@ -7,10 +7,10 @@ import { makeLogger } from './helpers';
let log = makeLogger('index');
let application = (options = {}, callback) => {
options.name = 'Kresus';
options.root = options.root || path.join(__dirname, '..');
options.port = process.env.PORT || 9876;
options.host = process.env.HOST || '127.0.0.1';
options.name = 'Kresus';
options.root = options.root || path.join(__dirname, '..');
options.port = process.env.PORT || 9876;
options.host = process.env.HOST || '127.0.0.1';
// If we try to import 'init', this has to be done at the global scope
// level. In this case, we will import init and its transitive closure of
......
import moment from 'moment';
import Access from '../models/access';
import Account from '../models/account';
import Alert from '../models/alert';
import Bank from '../models/bank';
import Config from '../models/config';
import Operation from '../models/operation';
import moment from 'moment';
import Access from '../models/access';
import Account from '../models/account';
import Alert from '../models/alert';
import Bank from '../models/bank';
import Config from '../models/config';
import Operation from '../models/operation';
import OperationType from '../models/operationtype';
import {
......@@ -17,10 +17,10 @@ import {
assert
} from '../helpers';
import AsyncQueue from './async-queue';
import alertManager from './alert-manager';
import AsyncQueue from './async-queue';
import alertManager from './alert-manager';
import Notifications from './notifications';
import diffAccounts from './diff-accounts';
import diffAccounts from './diff-accounts';
let log = makeLogger('accounts-manager');
......
import Emailer from './emailer';
import Emailer from './emailer';
import Notifications from './notifications';
import Account from '../models/account';
import Alert from '../models/alert';
import Config from '../models/config';
import Alert from '../models/alert';
import Config from '../models/config';
import { makeLogger, translate as $t, currency } from '../helpers';
......
......@@ -2,11 +2,11 @@ import moment from 'moment';
import Access from '../models/access';
import Config from '../models/config';
import Bank from '../models/bank';
import Bank from '../models/bank';
import accountManager from './accounts-manager';
import ReportManager from './report-manager';
import Emailer from './emailer';
import ReportManager from './report-manager';
import Emailer from './emailer';
import * as weboob from './sources/weboob';
......
......@@ -10,10 +10,10 @@ import {
import Emailer from './emailer';
import Account from '../models/account';
import Alert from '../models/alert';
import Account from '../models/account';
import Alert from '../models/alert';
import Operation from '../models/operation';
import Config from '../models/config';
import Config from '../models/config';
import moment from 'moment';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment