From 77f8739a4741e2370e40ec39345a92a6ea393a1a Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 2 Jul 2019 11:11:35 -0700 Subject: fix Layout/AlignArguments this is using: Layout/AlignArguments: Enabled: true EnforcedStyle: with_fixed_indentation the default style can use really excessive whitespace. on starting lines which are already long, it fully indents across to where the arguments start and then begins the line there. Signed-off-by: Lamont Granquist --- lib/chef/win32/api/crypto.rb | 4 ++-- lib/chef/win32/api/file.rb | 48 +++++++++++++++++++++--------------------- lib/chef/win32/api/net.rb | 2 +- lib/chef/win32/api/security.rb | 44 +++++++++++++++++++------------------- lib/chef/win32/file.rb | 2 +- lib/chef/win32/security.rb | 4 ++-- 6 files changed, 52 insertions(+), 52 deletions(-) (limited to 'lib/chef/win32') diff --git a/lib/chef/win32/api/crypto.rb b/lib/chef/win32/api/crypto.rb index ffd5d2e841..1b73ac65d1 100644 --- a/lib/chef/win32/api/crypto.rb +++ b/lib/chef/win32/api/crypto.rb @@ -35,8 +35,8 @@ class Chef CRYPTPROTECT_AUDIT = 0x10 class CRYPT_INTEGER_BLOB < FFI::Struct - layout :cbData, :DWORD, # Count, in bytes, of data - :pbData, :pointer # Pointer to data buffer + layout :cbData, :DWORD, # Count, in bytes, of data + :pbData, :pointer # Pointer to data buffer def initialize(str = nil) super(nil) if str diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb index e09fdd0ae4..eea46ce87d 100644 --- a/lib/chef/win32/api/file.rb +++ b/lib/chef/win32/api/file.rb @@ -189,7 +189,7 @@ class Chef # see https://msdn.microsoft.com/en-us/library/windows/desktop/ms647464(v=vs.85).aspx class Translation < FFI::Struct layout :w_lang, :WORD, - :w_code_page, :WORD + :w_code_page, :WORD end =begin @@ -200,7 +200,7 @@ typedef struct _FILETIME { =end class FILETIME < FFI::Struct layout :dw_low_date_time, :DWORD, - :dw_high_date_time, :DWORD + :dw_high_date_time, :DWORD end =begin @@ -212,8 +212,8 @@ typedef struct _SECURITY_ATTRIBUTES { =end class SECURITY_ATTRIBUTES < FFI::Struct layout :n_length, :DWORD, - :lp_security_descriptor, :LPVOID, - :b_inherit_handle, :DWORD + :lp_security_descriptor, :LPVOID, + :b_inherit_handle, :DWORD end =begin @@ -232,15 +232,15 @@ typedef struct _WIN32_FIND_DATA { =end class WIN32_FIND_DATA < FFI::Struct layout :dw_file_attributes, :DWORD, - :ft_creation_time, FILETIME, - :ft_last_access_time, FILETIME, - :ft_last_write_time, FILETIME, - :n_file_size_high, :DWORD, - :n_file_size_low, :DWORD, - :dw_reserved_0, :DWORD, - :dw_reserved_1, :DWORD, - :c_file_name, [:BYTE, MAX_PATH * 2], - :c_alternate_file_name, [:BYTE, 14] + :ft_creation_time, FILETIME, + :ft_last_access_time, FILETIME, + :ft_last_write_time, FILETIME, + :n_file_size_high, :DWORD, + :n_file_size_low, :DWORD, + :dw_reserved_0, :DWORD, + :dw_reserved_1, :DWORD, + :c_file_name, [:BYTE, MAX_PATH * 2], + :c_alternate_file_name, [:BYTE, 14] end =begin @@ -259,15 +259,15 @@ typedef struct _BY_HANDLE_FILE_INFORMATION { =end class BY_HANDLE_FILE_INFORMATION < FFI::Struct layout :dw_file_attributes, :DWORD, - :ft_creation_time, FILETIME, - :ft_last_access_time, FILETIME, - :ft_last_write_time, FILETIME, - :dw_volume_serial_number, :DWORD, - :n_file_size_high, :DWORD, - :n_file_size_low, :DWORD, - :n_number_of_links, :DWORD, - :n_file_index_high, :DWORD, - :n_file_index_low, :DWORD + :ft_creation_time, FILETIME, + :ft_last_access_time, FILETIME, + :ft_last_write_time, FILETIME, + :dw_volume_serial_number, :DWORD, + :n_file_size_high, :DWORD, + :n_file_size_low, :DWORD, + :n_number_of_links, :DWORD, + :n_file_index_high, :DWORD, + :n_file_index_low, :DWORD end =begin @@ -563,7 +563,7 @@ BOOL WINAPI VerQueryValue( def file_handle(path) path = canonical_encode_path(path) handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, - nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, nil) + nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, nil) if handle == INVALID_HANDLE_VALUE Chef::ReservedNames::Win32::Error.raise! @@ -577,7 +577,7 @@ BOOL WINAPI VerQueryValue( def symlink_file_handle(path) path = encode_path(path) handle = CreateFileW(path, FILE_READ_EA, FILE_SHARE_READ, - nil, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nil) + nil, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nil) if handle == INVALID_HANDLE_VALUE Chef::ReservedNames::Win32::Error.raise! diff --git a/lib/chef/win32/api/net.rb b/lib/chef/win32/api/net.rb index df4411b429..392a442962 100644 --- a/lib/chef/win32/api/net.rb +++ b/lib/chef/win32/api/net.rb @@ -146,7 +146,7 @@ class Chef class LOCALGROUP_INFO_1 < FFI::Struct layout :lgrpi1_name, :LPWSTR, - :lgrpi1_comment, :LPWSTR + :lgrpi1_comment, :LPWSTR end class USE_INFO_2 < FFI::Struct diff --git a/lib/chef/win32/api/security.rb b/lib/chef/win32/api/security.rb index b6b54a63d5..a856fbd0a1 100644 --- a/lib/chef/win32/api/security.rb +++ b/lib/chef/win32/api/security.rb @@ -326,24 +326,24 @@ class Chef # http://msdn.microsoft.com/en-us/library/windows/desktop/aa374931(v=VS.85).aspx class ACLStruct < FFI::Struct layout :AclRevision, :uchar, - :Sbzl, :uchar, - :AclSize, :ushort, - :AceCount, :ushort, - :Sbz2, :ushort + :Sbzl, :uchar, + :AclSize, :ushort, + :AceCount, :ushort, + :Sbz2, :ushort end class ACE_HEADER < FFI::Struct layout :AceType, :uchar, - :AceFlags, :uchar, - :AceSize, :ushort + :AceFlags, :uchar, + :AceSize, :ushort end class ACE_WITH_MASK_AND_SID < FFI::Struct layout :AceType, :uchar, - :AceFlags, :uchar, - :AceSize, :ushort, - :Mask, :uint32, - :SidStart, :uint32 + :AceFlags, :uchar, + :AceSize, :ushort, + :Mask, :uint32, + :SidStart, :uint32 # The AceTypes this structure supports def self.supports?(ace_type) @@ -358,12 +358,12 @@ class Chef class LUID < FFI::Struct layout :LowPart, :DWORD, - :HighPart, :LONG + :HighPart, :LONG end class LUID_AND_ATTRIBUTES < FFI::Struct layout :Luid, LUID, - :Attributes, :DWORD + :Attributes, :DWORD end class GENERIC_MAPPING < FFI::Struct @@ -375,13 +375,13 @@ class Chef class PRIVILEGE_SET < FFI::Struct layout :PrivilegeCount, :DWORD, - :Control, :DWORD, - :Privilege, [LUID_AND_ATTRIBUTES, 1] + :Control, :DWORD, + :Privilege, [LUID_AND_ATTRIBUTES, 1] end class TOKEN_PRIVILEGES < FFI::Struct layout :PrivilegeCount, :DWORD, - :Privileges, LUID_AND_ATTRIBUTES + :Privileges, LUID_AND_ATTRIBUTES def self.size_with_privileges(num_privileges) offset_of(:Privileges) + LUID_AND_ATTRIBUTES.size * num_privileges @@ -399,18 +399,18 @@ class Chef # https://msdn.microsoft.com/en-us/library/windows/desktop/ms721829(v=vs.85).aspx class LSA_OBJECT_ATTRIBUTES < FFI::Struct layout :Length, :ULONG, - :RootDirectory, :HANDLE, - :ObjectName, :pointer, - :Attributes, :ULONG, - :SecurityDescriptor, :PVOID, - :SecurityQualityOfService, :PVOID + :RootDirectory, :HANDLE, + :ObjectName, :pointer, + :Attributes, :ULONG, + :SecurityDescriptor, :PVOID, + :SecurityQualityOfService, :PVOID end # https://msdn.microsoft.com/en-us/library/windows/desktop/ms721841(v=vs.85).aspx class LSA_UNICODE_STRING < FFI::Struct layout :Length, :USHORT, - :MaximumLength, :USHORT, - :Buffer, :PWSTR + :MaximumLength, :USHORT, + :Buffer, :PWSTR end ffi_lib "advapi32" diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb index 101680fc90..274879a32d 100644 --- a/lib/chef/win32/file.rb +++ b/lib/chef/win32/file.rb @@ -190,7 +190,7 @@ class Chef mapping[:GenericAll] = Chef::ReservedNames::Win32::Security::FILE_ALL_ACCESS Chef::ReservedNames::Win32::Security.access_check(security_descriptor, duplicate_token, - desired_access, mapping) + desired_access, mapping) end def self.delete_volume_mount_point(mount_point) diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb index 6d9d359130..9a97fd77d2 100644 --- a/lib/chef/win32/security.rb +++ b/lib/chef/win32/security.rb @@ -56,8 +56,8 @@ class Chef granted_access_ptr = FFI::MemoryPointer.new(:ulong) unless AccessCheck(security_descriptor_ptr, token_handle, rights_ptr.read_ulong, - generic_mapping, privileges, privileges_length_ptr, granted_access_ptr, - result_ptr) + generic_mapping, privileges, privileges_length_ptr, granted_access_ptr, + result_ptr) Chef::ReservedNames::Win32::Error.raise! end result_ptr.read_ulong == 1 -- cgit v1.2.1