mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 06:25:19 +02:00
Lint fixes, brakeman update
This commit is contained in:
parent
3490043a54
commit
07e37065d9
12 changed files with 309 additions and 286 deletions
|
@ -2,7 +2,7 @@ class FamilyExportsController < ApplicationController
|
|||
include StreamExtensions
|
||||
|
||||
before_action :require_admin
|
||||
before_action :set_export, only: [:download]
|
||||
before_action :set_export, only: [ :download ]
|
||||
|
||||
def new
|
||||
# Modal view for initiating export
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'zip'
|
||||
require 'csv'
|
||||
require "zip"
|
||||
require "csv"
|
||||
|
||||
class Family::DataExporter
|
||||
def initialize(family)
|
||||
|
@ -39,7 +39,7 @@ class Family::DataExporter
|
|||
|
||||
def generate_accounts_csv
|
||||
CSV.generate do |csv|
|
||||
csv << ["id", "name", "type", "subtype", "balance", "currency", "created_at"]
|
||||
csv << [ "id", "name", "type", "subtype", "balance", "currency", "created_at" ]
|
||||
|
||||
# Only export accounts belonging to this family
|
||||
@family.accounts.includes(:accountable).find_each do |account|
|
||||
|
@ -58,7 +58,7 @@ class Family::DataExporter
|
|||
|
||||
def generate_transactions_csv
|
||||
CSV.generate do |csv|
|
||||
csv << ["date", "account_name", "amount", "name", "category", "tags", "notes", "currency"]
|
||||
csv << [ "date", "account_name", "amount", "name", "category", "tags", "notes", "currency" ]
|
||||
|
||||
# Only export transactions from accounts belonging to this family
|
||||
@family.transactions
|
||||
|
@ -80,7 +80,7 @@ class Family::DataExporter
|
|||
|
||||
def generate_trades_csv
|
||||
CSV.generate do |csv|
|
||||
csv << ["date", "account_name", "ticker", "quantity", "price", "amount", "currency"]
|
||||
csv << [ "date", "account_name", "ticker", "quantity", "price", "amount", "currency" ]
|
||||
|
||||
# Only export trades from accounts belonging to this family
|
||||
@family.trades
|
||||
|
@ -101,7 +101,7 @@ class Family::DataExporter
|
|||
|
||||
def generate_categories_csv
|
||||
CSV.generate do |csv|
|
||||
csv << ["name", "color", "parent_category", "classification"]
|
||||
csv << [ "name", "color", "parent_category", "classification" ]
|
||||
|
||||
# Only export categories belonging to this family
|
||||
@family.categories.includes(:parent).find_each do |category|
|
||||
|
|
|
@ -1,5 +1,28 @@
|
|||
{
|
||||
"ignored_warnings": [
|
||||
{
|
||||
"warning_type": "Redirect",
|
||||
"warning_code": 18,
|
||||
"fingerprint": "723b1970ca6bf16ea0c2c1afa0c00d3c54854a16568d6cb933e497947565d9ab",
|
||||
"check_name": "Redirect",
|
||||
"message": "Possible unprotected redirect",
|
||||
"file": "app/controllers/family_exports_controller.rb",
|
||||
"line": 30,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/redirect/",
|
||||
"code": "redirect_to(Current.family.family_exports.find(params[:id]).export_file, :allow_other_host => true)",
|
||||
"render_path": null,
|
||||
"location": {
|
||||
"type": "method",
|
||||
"class": "FamilyExportsController",
|
||||
"method": "download"
|
||||
},
|
||||
"user_input": "Current.family.family_exports.find(params[:id]).export_file",
|
||||
"confidence": "Weak",
|
||||
"cwe_id": [
|
||||
601
|
||||
],
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"warning_type": "Mass Assignment",
|
||||
"warning_code": 105,
|
||||
|
@ -105,5 +128,5 @@
|
|||
"note": ""
|
||||
}
|
||||
],
|
||||
"brakeman_version": "7.0.2"
|
||||
"brakeman_version": "7.1.0"
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class Family::DataExporterTest < ActiveSupport::TestCase
|
|||
assert zip_data.is_a?(StringIO)
|
||||
|
||||
# Check that the zip contains all expected files
|
||||
expected_files = ["accounts.csv", "transactions.csv", "trades.csv", "categories.csv", "all.ndjson"]
|
||||
expected_files = [ "accounts.csv", "transactions.csv", "trades.csv", "categories.csv", "all.ndjson" ]
|
||||
|
||||
Zip::File.open_buffer(zip_data) do |zip|
|
||||
actual_files = zip.entries.map(&:name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue