File stripe_form3.js
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* jshint sub: false */
/* Sripe API version 2019-02-19 */
window.ST = window.ST || {};
window.ST.stripe_form_i18n = window.ST.stripe_form_i18n || {
'account_number' : 'Account number',
Function init
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function(options) {
BANK_RULES = options.bank_rules;
window.ST.stripe_test_api_mode = options.stripe_test_mode;
stripeApi = Stripe(options.api_publishable_key);
add_validators();
Function prepareData
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
var prepareData = function(options) {
var country = getValue('address_country'),
firstName = getValue('first_name'),
lastName = getValue('last_name'),
address, person;
Function submitHandler
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
submitHandler: function(form) {
removeSpaces();
stripeFormData = $(form).serializeArray();
var data = prepareData(options),
documentFrontEl = $('#stripe_account_form_document_front'),
Function stripeUploadFiles
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
var stripeUploadFiles = function stripeUploadFiles(options) {
var uploadFiles = function uploadFiles() {
var fileData, itemKey, fileForm, additionalFileForm, additionalFileData, fileResult;
return regeneratorRuntime.async(function uploadFiles$(_context) {
while (1) {
Function add_validators
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
var add_validators = function() {
function explain_regexp(value) {
var t = value;
t = t.replace(/-\[/g, ';'+i18n_label('a_dash', 'a dash')+';[');
t = t.replace(/\[0-9\]\{(\d+)}/g, ';$1 '+i18n_label('digits', 'digits')+';');
Function uploadFiles
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var uploadFiles = function uploadFiles() {
var fileData, itemKey, fileForm, additionalFileForm, additionalFileData, fileResult;
return regeneratorRuntime.async(function uploadFiles$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Function uploadFiles$
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
return regeneratorRuntime.async(function uploadFiles$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
fileData = {};
Similar blocks of code found in 2 locations. Consider refactoring. Open
person = {
first_name_kana: getValue('first_name_kana'),
last_name_kana: getValue('last_name_kana'),
first_name_kanji: getValue('first_name_kanji'),
last_name_kanji: getValue('last_name_kanji'),
- Read upRead up
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 56.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
address_kana: {
postal_code: getValue('address_kana_postal_code'),
state: getValue('address_kana_state'),
city: getValue('address_kana_city'),
town: getValue('address_kana_town'),
- Read upRead up
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 51.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
address_kanji: {
postal_code: getValue('address_kanji_postal_code'),
state: getValue('address_kanji_state'),
city: getValue('address_kanji_city'),
town: getValue('address_kanji_town'),
- Read upRead up
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 51.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
address: {
city: getValue('address_city'),
state: getValue('address_state'),
country: getValue('address_country'),
postal_code: getValue('address_postal_code'),
- Read upRead up
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 51.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76