diff --git a/README.md b/README.md index 64c0b6d..654b5b6 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ use. This is where velocifilter comes in. By using the library we can provide a single flag where the user may specify a flexible VQL query (Velocidex Query Language - a simplified SQL dialect) allowing the user to specify -arbirarily complex filter expressions. For example: +arbitrarily complex filter expressions. For example: SELECT file from glob(pattern=["*.go", "*.py"]) where file.Size < 5000 and file.Mtime < now() - "5 days" @@ -74,7 +74,7 @@ package to add an interface to an existing type without creating a new type which embeds it. Clients who need to handle the original third party types must have a way to attach new protocols to existing types defined outside their own codebase. Velocifilter achieves this by -implementing a registration systen in the Scope{} object. +implementing a registration system in the Scope{} object. For example, consider a client of the library wishing to pass custom types in queries: diff --git a/api.go b/api.go index 6a8b7b2..97e737b 100644 --- a/api.go +++ b/api.go @@ -49,7 +49,7 @@ func GetResponseChannel( Payload: s, } - // We dont know the columns but we have at + // We don't know the columns but we have at // least one row. Set the columns from this // row. if len(rows) > 0 { diff --git a/docs/destructors.md b/docs/destructors.md index 7204358..6d196dd 100644 --- a/docs/destructors.md +++ b/docs/destructors.md @@ -51,7 +51,7 @@ fd.Close() ``` However, our query above will just throw away Y and Z because only the -X property is neded: `SELECT X FROM plugin()`. +X property is needed: `SELECT X FROM plugin()`. How can we produce lazy objects? @@ -80,7 +80,7 @@ output_chan <- row This solves the problem of evaluating Y and Z unnecessarily, but now it is not clear when we should close the file? We must do so only -*after* the lazy function is evaulated but we do not know when that +*after* the lazy function is evaluated but we do not know when that will be. If we immediately close the file after pushing the lazy row to the @@ -183,7 +183,7 @@ not Y() or Z() avoiding the extra work. This is particularly important for parsers who can spend a lot of time and cpu parsing files - even if the query does not actually need that -information. Writing parsers in a lazy fasion helps make them more +information. Writing parsers in a lazy fashion helps make them more efficient. ## Alternative 2 - ordereddict based rows @@ -193,7 +193,7 @@ plugin to forward an ordereddict based row with callables as values ```golang output_chan <- ordereddict.NewDict(). - Set("X", func() {CalculateX(fd)}). <-- lazy functions evaulated on access. + Set("X", func() {CalculateX(fd)}). <-- lazy functions evaluated on access. Set("Y", func() {CalculateY(fd)}). Set("Z", func() {CalculateZ(fd)}) ``` diff --git a/functions/aggregates.go b/functions/aggregates.go index 13e69d2..e5928af 100644 --- a/functions/aggregates.go +++ b/functions/aggregates.go @@ -18,12 +18,12 @@ // 1. Each aggregate function instance in the AST carries a unique // ID. This allows the function to store its own state in the // aggregate context without interference from other instances of -// the same function (e.g. having two count() instaces is OK) +// the same function (e.g. having two count() instances is OK) // 2. The scope may contain a reference to an AggregatorCtx // object. This object manages access to the aggregate // context. The main method that should be used is Modify() which -// mofidies the context under lock. +// modifies the context under lock. // 3. When the scope spawns a child scope, the child scope does not // have its own AggregatorCtx, instead chasing its parent to find diff --git a/functions/functions.go b/functions/functions.go index 4abf70d..951e48b 100644 --- a/functions/functions.go +++ b/functions/functions.go @@ -174,7 +174,7 @@ type _EncodeFunction struct{} func (self _EncodeFunction) Info(scope types.Scope, type_map *types.TypeMap) *types.FunctionInfo { return &types.FunctionInfo{ Name: "encode", - Doc: "Encodes a string as as different type. Currently supported types include 'hex', 'base64'.", + Doc: "Encodes a string as a different type. Currently supported types include 'hex', 'base64'.", ArgType: type_map.AddType(scope, _EncodeFunctionArgs{}), } } diff --git a/grouper/grouper.go b/grouper/grouper.go index 7634ac5..26cbafb 100644 --- a/grouper/grouper.go +++ b/grouper/grouper.go @@ -1,4 +1,4 @@ -// Immplements group by operation +// Implements group by operation package grouper diff --git a/marshal/marshaller.go b/marshal/marshaller.go index 9378db8..b62d2c9 100644 --- a/marshal/marshaller.go +++ b/marshal/marshaller.go @@ -40,7 +40,7 @@ func Marshal(scope types.Scope, item interface{}) (*types.MarshalItem, error) { // The default marshaller is to just convert it into // JSON and hope for the best - but we let the user - // know we dont know how to handle it. + // know we don't know how to handle it. default: serialized, err := json.Marshal(item) if err != nil { diff --git a/materializer/in_memory.go b/materializer/in_memory.go index 82ef23b..3a47bfd 100644 --- a/materializer/in_memory.go +++ b/materializer/in_memory.go @@ -47,7 +47,7 @@ func (self InMemoryMatrializer) Applicable(a types.Any, b types.Any) bool { return true } -// Just deletegate to our contained rows array. +// Just delegate to our contained rows array. func (self InMemoryMatrializer) GetMembers(scope types.Scope, a types.Any) []string { a_materializer, ok := a.(*InMemoryMatrializer) if !ok { @@ -78,10 +78,10 @@ func (self *InMemoryMatrializer) MarshalJSON() ([]byte, error) { } // An object implementing the ScopeMaterializer interface. This is the -// default meterializer used in VQL to expand a LET query into the +// default materializer used in VQL to expand a LET query into the // scope. It returns wrapper that contains the list of rows in // memory. Library users may register a more sophisticated -// meterializer that backs data in more scalable storage to avoid +// materializer that backs data in more scalable storage to avoid // memory costs. type DefaultMaterializer struct{} diff --git a/ordereddict_test.go b/ordereddict_test.go index 22841ca..fe06b6c 100644 --- a/ordereddict_test.go +++ b/ordereddict_test.go @@ -18,7 +18,7 @@ type dictSerializationTest struct { var dictSerializationTests = []dictSerializationTest{ {ordereddict.NewDict().Set("Foo", "Bar"), `{"Foo":"Bar"}`}, - // Test an unserilizable member - This should not prevent the + // Test an unserializable member - This should not prevent the // entire dict from serializing - only that member should be // ignored. {ordereddict.NewDict().Set("Foo", "Bar"). diff --git a/protocols/protocol_add.go b/protocols/protocol_add.go index 304bbc9..1936dab 100644 --- a/protocols/protocol_add.go +++ b/protocols/protocol_add.go @@ -31,7 +31,7 @@ func (self AddDispatcher) Copy() AddDispatcher { // float int -> lhs + float(rhs) // float float -> lhs + rhs -// We dont handle any other additions with ints here. +// We don't handle any other additions with ints here. func intAdd(lhs int64, b types.Any) (types.Any, bool) { switch b.(type) { case int, int8, int16, int32, int64, uint8, uint16, uint32, uint64: @@ -43,7 +43,7 @@ func intAdd(lhs int64, b types.Any) (types.Any, bool) { return float64(lhs) + rhs, true } - // We dont handle any other additions here + // We don't handle any other additions here return &types.Null{}, false } diff --git a/protocols/protocol_associative.go b/protocols/protocol_associative.go index 1832b20..9ee988d 100644 --- a/protocols/protocol_associative.go +++ b/protocols/protocol_associative.go @@ -64,7 +64,7 @@ func (self *AssociativeDispatcher) Associative( case types.LazyRow: return t.Get(b_str) - // Dereferencing a stroed query expands all + // Dereferencing a stored query expands all // fields and extracts a single column case types.StoredQuery: result := []types.Row{} diff --git a/protocols/protocol_div.go b/protocols/protocol_div.go index 33e7e89..71c493c 100644 --- a/protocols/protocol_div.go +++ b/protocols/protocol_div.go @@ -51,7 +51,7 @@ func (self DivDispatcher) Div(scope types.Scope, a types.Any, b types.Any) types } } - // Always convert to float to not lose preceision. + // Always convert to float to not lose precision. a_int, ok := utils.ToFloat(a) if ok { b_int, ok := utils.ToFloat(b) diff --git a/scope/scope.go b/scope/scope.go index 420660a..5df185a 100644 --- a/scope/scope.go +++ b/scope/scope.go @@ -531,7 +531,7 @@ func (self *Scope) Close() { // the order the destructors are called on the same scope, we // sometimes need to retry the destructors. This means the // destructors will reschedule themselves to be called again. At - // the end of this function we prevent new detructors from being + // the end of this function we prevent new destructors from being // added to this scope. // Stop new destructors from appearing on this scope, once this @@ -539,7 +539,7 @@ func (self *Scope) Close() { defer self.destructors.SetDestroyed() // Destructors are called in reverse order to their - // declerations. + // declarations. for try := 0; try < 10; try++ { // Remove destructors from list so they are not run again. ds := self.destructors.RemoveDestructors() @@ -578,7 +578,7 @@ func NewScope() *Scope { id: NextId(), } - // Add Builtin protocols, functions, and plugins + // Add Built-in protocols, functions, and plugins dispatcher.AddProtocolImpl(protocols.GetBuiltinTypes()...) dispatcher.AppendFunctions(result, functions.GetBuiltinFunctions()...) dispatcher.AppendPlugins(result, plugins.GetBuiltinPlugins()...) diff --git a/types/functions.go b/types/functions.go index 8fd2132..eefc16a 100644 --- a/types/functions.go +++ b/types/functions.go @@ -34,7 +34,7 @@ type PluginInfo struct { // versions of this plugin if needed. Version int - // Arbitrary metadata attched to the plugin info + // Arbitrary metadata attached to the plugin info Metadata *ordereddict.Dict // Set to true if the plugin accepts free form args (i.e. any @@ -58,7 +58,7 @@ type FunctionInfo struct { // versions of this function if needed. Version int - // Arbitrary metadata attched to the function info + // Arbitrary metadata attached to the function info Metadata *ordereddict.Dict // Set to true if the plugin accepts free form args (i.e. any diff --git a/types/grouper.go b/types/grouper.go index 66d07fd..91072af 100644 --- a/types/grouper.go +++ b/types/grouper.go @@ -13,7 +13,7 @@ import ( // grouper. type GroupbyActor interface { // Just receive new rows. Return EOF when no more rows exist. Returns - // 1. The next trasformed row to group. + // 1. The next transformed row to group. // 2. The original untransformed row (that can from the plugin). // 3. The group by bin index // 4. The scope over which the query is materialized. diff --git a/types/introspection.go b/types/introspection.go index de36ee5..5e8c983 100644 --- a/types/introspection.go +++ b/types/introspection.go @@ -39,7 +39,7 @@ func (self *TypeMap) Get(scope Scope, name string) (*TypeDescription, bool) { // Introspect the type of the parameter. Add type descriptor to the // type map and return the type name. func (self *TypeMap) AddType(scope Scope, a Any) string { - // Dont do anything if the caller does not care about a type + // don't do anything if the caller does not care about a type // map. if self == nil || scope == nil { return "" diff --git a/utils/unquote.go b/utils/unquote.go index f258f5f..2007877 100644 --- a/utils/unquote.go +++ b/utils/unquote.go @@ -9,14 +9,14 @@ import ( // unquote either a " or ' delimited string. func Unquote(s string) string { // If we start with ''' this is a literal string - do not - // interfer at all. + // interfere at all. if strings.HasPrefix(s, "'''") { if strings.HasSuffix(s, "'''") { return s[3 : len(s)-3] } } - // This should not happen but in case it does do not interfer at all. + // This should not happen but in case it does do not interfere at all. quote := s[0] if quote != '"' && quote != '\'' { return s diff --git a/vfilter.go b/vfilter.go index 1ae5448..058d502 100644 --- a/vfilter.go +++ b/vfilter.go @@ -52,7 +52,7 @@ use. This is where velocifilter comes in. By using the library we can provide a single flag where the user may specify a flexible VQL query (Velocidex Query Language - a simplified SQL dialect) allowing the -user to specify arbirarily complex filter expressions. For example: +user to specify arbitrarily complex filter expressions. For example: SELECT file from glob(pattern=["*.go", "*.py"]) where file.Size < 5000 and file.Mtime < now() - "5 days" @@ -81,7 +81,7 @@ package to add an interface to an existing type without creating a new type which embeds it. Clients who need to handle the original third party types must have a way to attach new protocols to existing types defined outside their own codebase. Velocifilter achieves this by -implementing a registration systen in the Scope{} object. +implementing a registration system in the Scope{} object. For example, consider a client of the library wishing to pass custom types in queries: @@ -331,7 +331,7 @@ type _ParameterListTerm struct { // Returns the type of statement it is: // LAZY_LET - A lazy stored query -// MATERIALIZED_LET - A stored meterialized query. +// MATERIALIZED_LET - A stored materialized query. // SELECT - A query func (self *VQL) Type() string { if self.LetOperator == "=" { @@ -966,7 +966,7 @@ func (self *_SelectExpression) Transform( // If there is a * expression in addition to the column // expressions, this is equivalent to adding all the columns as - // defined by the * as if they were explicitely defined. + // defined by the * as if they were explicitly defined. if self.All { for _, member := range scope.GetMembers(row) { value, pres := scope.Associative(row, member) diff --git a/vfilter_group.go b/vfilter_group.go index ae1f5f1..4912d39 100644 --- a/vfilter_group.go +++ b/vfilter_group.go @@ -63,7 +63,7 @@ func (self *GroupbyActor) GetNextRow(ctx context.Context, scope types.Scope) ( } // Materialize the group by value as much as possible - we - // dont want a lazy item here. + // don't want a lazy item here. gb_element := types.ToString(ctx, new_scope, self.delegate.GroupBy.Reduce(ctx, new_scope)) diff --git a/vfilter_test.go b/vfilter_test.go index 4ab7ab7..6c16b72 100644 --- a/vfilter_test.go +++ b/vfilter_test.go @@ -271,7 +271,7 @@ var execTestsSerialization = []execTest{ {"'Hello'[-2:300]", "lo"}, {"'Hello'[-3:]", "llo"}, - // Rgexp operator + // Regexp operator {"'Hello' =~ '.'", true}, // . matches anything including the empty string (it is optimized away). @@ -564,7 +564,7 @@ var vqlTests = []vqlTest{ // The below query demonstrates that the query() function is // run on every row returned from the filter, and then the - // output is filtered by the the where clause. Be aware that + // output is filtered by the where clause. Be aware that // this may be expensive if test() returns many rows. {"Subselect functions in filter.", `select bar, {select * from dict(column=bar)} as Query diff --git a/visitor.go b/visitor.go index 03e3ed7..4dd9b63 100644 --- a/visitor.go +++ b/visitor.go @@ -24,7 +24,7 @@ var ( IndentWidthThreshold: 50, MaxWidthThreshold: 80, - // If false we dont break lines at all - all tokens are + // If false we don't break lines at all - all tokens are // written on the same line. BreakLines: true, } @@ -43,7 +43,7 @@ var ( ) type FormatOptions struct { - // Threshold above which we indent more aggresively on new + // Threshold above which we indent more aggressively on new // lines. Below the threshold we try to keep lines together. IndentWidthThreshold int MaxWidthThreshold int @@ -197,7 +197,7 @@ func (self *Visitor) line_break() { last_fragment = self.Fragments[len(self.Fragments)-1] } - // Format all on the same line. Strictly we dont actually need + // Format all on the same line. Strictly we don't actually need // spaces but we add them for readability. if !self.opts.BreakLines { switch last_fragment { @@ -474,7 +474,7 @@ func (self *Visitor) visitAliasedExpression(node *_AliasedExpression) { } else if node.SubSelect != nil { self.push("{", " ") - // We prefer the subquery to start at the begining of the line + // We prefer the subquery to start at the beginning of the line // with a little indent. if self.opts.BreakLines { self.new_line(2) @@ -814,7 +814,7 @@ func (self *Visitor) visitArgs(node *_Args) { } else if node.SubSelect != nil { self.push(node.Left, "={") - // We prefer subquery to start at the begining of the line + // We prefer subquery to start at the beginning of the line // with a small indent. if self.opts.BreakLines { self.new_line(2) @@ -1195,7 +1195,7 @@ func (self *Visitor) abTest( } } - // When not in reformat mode we really dont care which option + // When not in reformat mode we really don't care which option // we choose. if !self.opts.BreakLines { self.merge(test_visitor) @@ -1221,7 +1221,7 @@ func (self *Visitor) abTest( // Is the other visitor better than this one? func (self *Visitor) is_better(other *Visitor) bool { - // Most important priority is to ensure we dont exceed the max + // Most important priority is to ensure we don't exceed the max // width by much. /* fmt.Printf("self %v (%v lines)\n%v\n - other %v (%v lines)\n%v\n", @@ -1230,7 +1230,7 @@ func (self *Visitor) is_better(other *Visitor) bool { */ max_width := self.opts.MaxWidthThreshold - // If the other formatting exceeds the max line number but we dont + // If the other formatting exceeds the max line number but we don't // then reject it. if other.max_width > max_width && self.max_width < max_width { return false